Repeating Segments (and Loops) that Use the Same Qualifier
Repeating qualified segments that use the same qualifier value can be problematic but must be supported in order to provide mechanisms for communicating complete information for an interchange. Implementers must agree on if or how segments with repeated qualifiers are used in a particular context.
The X12 EDI structure allows segments (and segments that start loops) to repeat more than once by using a data element that 'qualifies' or provides a unique meaning to that segment (or loop).
As an example, the N1 segment is used in many transactions, including healthcare, supply chain, transportation, and finance applications. The N1 structure allows for one-to-many parties to be identified by means of 'qualifier' data element 98, the Entity Identifier Code, in position N101.
If we need to identify the parties to a transaction, such as the buyer and seller, we would construct and transmit two segments
- N1*SE*GREAT PAPER COMPANY~ Seller
- N1*BY*HAPPY RETAIL STORES, INC~ Buyer
The X12 Standard does not put any constraints or have any recommendations on the use of the same EDI qualifier value in successive segment or loops. But what if the following scenario occurs where the following segments are transmitted as shown using the same N101 qualifier value but with different N102 values:
- N1*SE*GREAT PAPER COMPANY~
- N1*SE*LESSER PAPER COMPANY~
- N1*SE*HYDROPONIC SERVICES, INC~
How does a business application interpret the three segments above with the same N101 value?
Depending on how the receiving system is designed, options may include:
- The first segment/loop (Great Paper Company) is captured, and successive N1*SE segments/loops are ignored
- The last segment/loop (Hydroponic Services, Inc) is captured, having overwritten the prior two N1*SE segments/loops.
- All of the segments/loops are captured, and the application system determines how to handle the 'duplicates'.
Various industries leverage and constrain the use of repeating segments with the same qualifier in different ways:
- In Transportation, a repeating segment/loop qualifier value is expected in specified instances. For example, concerning a hazardous materials shipment in the rail industry for the movement of non-conforming rail cars, they say, "Should FRA OTMA (One Time Movement Approval) exceed 30 characters use additional iterations of the LHR segment with LHR01 code 'AH'. For FRA OTMA on Non – Hazardous shipments, see N9 Guidelines in 404 and 417."
- In Supply Chain, a repeating segment/loop qualifier value is not expected and would typically result in a data 'overwrite' scenario.
- In Health Care, a repeating segment/loop qualifier value is permitted because there are scenarios when it is expected.
The role of the X12 Standard is to provide the business application with the data it needs. Since X12 EDI is used in many industries and companies, and since there are many business applications or practices which may or may not allow for repetitive segment qualifiers, there is no 'best practice' that pertains to the X12 Standard.
X12 EDI allows each industry, business, trade relationship and set of business practices to determine how repeating segments/loops should be implemented. It is incumbent on the industry, business, and trade parties to define what is allowed or not allowed, which can be memorialized in an implementation convention that complies with X12's Intellectual Property Usage Policy. It is the responsibility of the trading partners to determine what is appropriate for their specific business requirements and how their business applications will function.