BDO TOOLS  -  Align Fields Add Fields Make Fields

Match Fields

When the Match Fields control is selected, the Align Fields tool, during a subsequent Check, matches fields based on:
  • The number of fields per input file line.
  • The type of each field as determined by the Quotes control.
When matching fields, the Align Fields tool initially determines the number of fields and each field's type for the first line. A field's type is considered to be either quoted (using the quotation marks specified by the Quotes control) or unquoted.

The number of fields and each field's type are computed for each subsequent line of the input file and this information is then compared with the information gleaned from the first line.

If a discrepancy in number of fields or field type is identified, an appropriate message is displayed and the Output Top area is not displayed.

If all lines contain the same number of fields and each field at a certain position on each line is of the same type, the match succeeds, the Output Top area is displayed and the OK button is enabled.

Examples

If an input file contains the following lines:

 xxx (1, "abc", 101, rst);
 xxx (2, "def", 202, uvw);
 xxx (3, "ghi", 303, xyz);

As each line contains the same number (4) of fields, and, positionally, each field is of the same type (the first, third and fourth fields of each line are unquoted, and the second field of each line is quoted) a Check incorporating Match Fields will be successful.

If an input file contains the following lines:

 xxx ("ab", 101, st);
 xxx ("cd", 202, "uv");
 xxx ("ef", 303, wx);
 xxx ("gh", 404, yz);

Although each line contains the same number (3) of fields, a Check incorporating Match Fields will fail after line 2 has been processed because field 3 of this line is quoted and the corresponding field of line 1 is unquoted.

Note

When the Match Fields control is selected, the Enforce Strict Field Count control is also automatically selected.
 
Copyright © 2018 Brian D. Ogilvie www.bdozone.com  :