FlatFile Module 10.7 | Flat File Schema Developer's Guide | Working with Elements in Flat File Schemas and Dictionaries | Validators | Conditional Validators
 
Conditional Validators
Regardless of what type of flat file you are processing, you follow the syntax rules created by the EDI Standards bodies ANSI X12 or UN/EDIFACT to specify conditional validators for a flat file record or composite. In these rules, 0n and 0n0 represent the number of the field defined in the record or composite, where n is the number of the field in the composite or record. For example, in the following flat file:

Record1*FieldA*FieldB*FieldC*FieldD*FieldE;
To validate fields using the ANSI X12 conditional validator, you might enter the following in the Validator property:
To validate the appropriate fields using the UN/EDIFACT conditional validator, you might enter the following in the Validator property:
The record definition has five fields defined. Each with an Nth Field extractor, the first extracting field A, the second field B and so on. Both of these validators indicate that if Field A is present, Field B is required. If Field C is present, Field D and Field E are required. However, if Field D and Field E are present, Field C need not be present.
The conditional validator refers to the location of the field in the definition, not the location of the data in the flat file. For example, if you switched the extractors for the first and second field such that the first field extracted the value Field B and the second field extracts the value Field A, the conditional validator would indicate that if Field B is present Field A is required.
Example:
Record1 - conditional validator C0102
FieldA - Nth field extractor, position 1
FieldB - Nth field extractor, position 2
This indicates that if FieldA is present Field B also must be present. If you switched the position of these fields in the record, you would get the following.
Example:
Record1 - conditional validator C0102
FieldB - Nth field extractor, position 2
FieldA - Nth field extractor, position 1
This now indicates that if Field B is present Field A also must be present.
ANSI X12 Rule Name (and Code)
UN/EDIFACT Rule Name (and Code)
Definition
Required (R)
One or more (D3)
At least one of the specified fields must be present.
ANSI X12 Example: R030405
UN/EDIFACT Example: D3(030,040,050)
Conditional (C)
If first, then all (D5)
If a specified field is present, all of the fields specified in a dependent set of fields also must be present. If a dependent field is present, the first specified field need not be present.
ANSI X12 Example: C030405
UN/EDIFACT Example: D5(030,040,050)
Exclusion (E)
One or none (D4)
At most, only one of the specified fields can be present.
ANSI X12 Example: E030405
UN/EDIFACT Example: D4(030,040,050)
List Conditional (L)
If first, then at least one (D6)
If a specified field is present, at least one of the fields specified in a dependent set of fields also must be present. If a dependent field is present, the first specified field need not be present.
ANSI X12 Example: L030405
UN/EDIFACT Example: D6(030,040,050)
Paired (P)
All or none (D2)
All of the specified fields must be present or absent.
ANSI X12 Example: P030405
UN/EDIFACT Example: D2(010,020)
N/A
One and only one (D1)
Exactly one field may be present.
UN/EDIFACT Example: D1(030,040,050)
NA
If first, then none (D7)
If the first field is present, all others cannot be included.
UN/EDIFACT Example: D7(030,040,050)