# Compare Fields

This function compares fields to determine if they have or do not have the same values. There are two modes of operation:

Test
  This is the most common mode and sets the action test state based on the result of the comparison. If the Not option is set, you are testing for failure (true if failed). If the Not option is not set, you are testing for success (true if succeeded). The test result can be Set, Anded or Ored to the action test state.
Report
  This mode goes back to the very early days of Yate and is only maintained for continuity reasons. If fields are not the same based on possible criteria, the Action Pending Window dialog will be displayed. ie. you will be prompted if fields differ.

There are three modes of operation:

- When the selected mode is Files, you are testing if the individual fields are not the same in every file. For example you might want to test if the Year field is the same in every file.
- When the selected mode is Fields, you are testing within each file if any specified fields have the different values. For example you might want to test if each file has the same value for the Artist and Album Artist fields.
- When the selected mode is Both, you are testing if any of the specified fields, are not equal anywhere. For example you might use the same example of Artist and Album Artist.

Artwork can be compared but only when the mode is Files. A non match on artwork can be due to a different: number of items, image data, image order or metadata.

Criteria can be specified by clicking on the Criteria button. the following items are available:

Case insensitive
  Alphabetic case is ignored when comparing values. This has no effect when comparing Artwork.
Diacritic insensitive
  Accents are ignored when comparing values. This has no effect when comparing Artwork.
Ignore leading and trailing spaces
  Leading and trailing spaces are ignored when comparing values. This has no effect when comparing Artwork.
Determining how empty values are handled
  You can specify how empty values are to be processed. The following options are available:
  No Special Empty Value Processing
    Empty values are treated the same as any other value.
  Fail on Empty Values
    The presense of an empty value causes the test result to fail.
  Ignore Empty Values
    Empty values are ignored and do not effect the test result. Empty values are not compared against others.
  Ignore Empty Values Unless All are Empty
    Empty values are ignored unless all values are empty in which case a test will fail. When the mode is Fields or Both, this is only evaluated on a per file basis. ie. all tested fields in a given file must be empty to fail. When the mode is Files, this is evaluated on a per field basis. ie. a given field must be empty in all files to fail.

You can also specify an Indirect option. This is only useful if you want to decide at runtime which fields to compare. Typically in this mode you will be comparing track variables which contain the names of other fields. If an extracted field name is unknown or not valid for the mode, the test fails. The indirection is done on a per file and field basis. This means different indirections can resolve to different fields. For example if comparing Variable 1 and one file has variable 1 equal to Artist and another has Variable 1 equal to Genre, the test will compare Artist against Genre. It is strongly recommended that if you want to use indirection that you keep it simple. Use a single variable which has the same field name for all files and use the Files mode.

While valid during grouped execution, the statement was designed primarily for stepwise execution. Other than the Fields mode, the others may be irrelevant when execution grouped.