Element pair constraints enables you to specify which elements may or may not be used in a segment based on the usage of another elements in the same segment.
For example, you may want to specify that if element 1 in a segment is used then element 2 and element 3 must also be used.
There are 5 types of element pair constraints that a segment can have:
Example: P060708. If any of element 06, 07, or 08 are present, then all are required.
Example: C0102. If element 1 is present then element 2 is required.
Example: C0102C030405. If element 01 is present, then 02 is required. If element 03 is present,
then both 04 and 05 are required.
Example: R0708R0910. At least one of element 07 and 08 is required, and at least one of
09 and 10 is required.
List Conditional Constraints
Example: L060810. If element 06 is present, then at least one of 08 or 10 is required.
Example: E060810. Only one of 06, 08, or 10 may be present.
Adding Element Pair Constraints To A Segment, Method 1
- From the TEMPLATE SEGMENTS tab on the main screen right click on a template segment then select the View/Edit menu option
- When the Template Segment Dialog appears click on the Element Constraints Tab. You will see a table with two columns; Constraint and Elements
- Click on the NEW CONSTRAINTS button. A new row will appear in the table.
- Select the element pair constraint from the Constraints column
- Now enter the element ordinal number of the elements that the constraint applies to. An element ordinal number is just the position of the element in the segment. Element ordinal numbers are separated by a space.
From the above example you can see that template segment NM1 has an element pair constraint that say that if element 8 or element 9 is used then the other one is required.
- Click on the UPDATE button to update the information
Adding Element Pair Constraints To A Segment, Method 2
- Open the EDI rules file explicitly with notepad or any other text editor
- Go to the SEGMENT DEFINITIONS section
- At the end of the segment that you want to place an element pair constraint, add a ‘+’ symbol followed by one or more of the element pair constraints