Some Data Elements with the same qualifiers may appear multiple times in an EDI document but need to be mapped to different target fields. Each EDI Section may repeat in the EDI File, for example, for multiple products or multiple SKUs. To isolate the common Data Elements, the EDI file can be partitioned through the definition of sections. These sections may be nested. For example, a Product section may have multiple SKU sections. The start of each section is denoted by a matching Qualified Data Element within the context of the current EDI section. For example, if Products contain multiple SKUs and both Products and SKUs have measurements, then a MEA data element for Height would be attributed to the Product if the current section is Product or to the SKU if the current section is SKU.
The EDI Sections are hierarchical in nature. Except for the top EDI Section, each subsequent EDI Section must be a child of another EDI Section. Multiple EDI Sections can have the same parent EDI Section.
Example 1 – an EDI file with no looping and no duplicate data elements can be expressed with a single EDI Section containing one of the first Data Elements found in the EDI File:
- EDI Section - Data Element Name = GS, Is Output Row = Yes
Example file:
ISA*00* *00* *14*2143981411 *12*314493968901 *180610*1239*U*00401*000895068*0*P*>
GS*SC*2143981411*314493968901*20180610*1239*1049331*X*00401
ST*832*1049331
BCT*PS**2
REF*11*314493968901
CUR*SE*USD
LIN**GS*S0931F15373430*MF*DalTile*ST*0931***SZ*18x18*MS*S0931F15373430*MN*Heathland Field
Tile Floor 18x18 PK18.00
DTM*197*20180610
REF*19**DalTile
PID*F*TRN***Heathland Field Tile Floor 18x18 PK18.00
PID*F*MAC***CERFLO
PID*F*PNA***Heathland Field Tile Floor 18x18 PK18.00
PID*F*CO***Heathland
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
MEA**SU*18*SF
CTP**LPR*1.11*1*SF
DTM*007*20180604
SLN*1**O******SK*HL0218181P2***MG*HL02*ST*0931***SZ*18x18*MS*S0931F15373430*MN*Heathland
Field Tile Floor 18x18 PK18.00
PID*F*73***RAFFIA Unpolished
PID*F*35***HL02UP
PID*F*PNA***Heathland Field Tile Floor 18x18 PK18.00
CTP**LPR*1.11*1*SF
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
LIN**GS*S0222F04110650*MF*DalTile*ST*0222***SZ*12x12*MS*S0222F04110650*MN*Salerno Deco
Accent 12x12
DTM*197*20180609
REF*19**DalTile
PID*F*TRN***Salerno Deco Accent 12x12
PID*F*MAC***CERWAL
PID*F*PNA***Salerno Deco Accent 12x12
PID*F*CO***Salerno
MEA**LN*1.00000000*EZ
MEA**WD*1.00000000*EZ
MEA**SU*9*SF
CTP**LPR*18.77*1*SF
DTM*007*20170405
SLN*1**O******SK*SL871212DECO1P2***MG*SL87*ST*0222***SZ*12x12*MS*S0222F04110650*MN*Salerno
Deco Accent 12x12
PID*F*73***UNIVERSAL Glazed
PID*F*35***SL87G
PID*F*PNA***Salerno Deco Accent 12x12
CTP**LPR*18.77*1*SF
MEA**LN*1.00000000*EZ
MEA**WD*1.00000000*EZ
LIN**GS*S0222F04110651*MF*DalTile*ST*0222***SZ*3x12*MS*S0222F04110651*MN*Salerno Deco
Accent 3x12
Example 2 – an EDI File contains multiple Products, each having one or more SKUs:
- EDI Section - Data Element Name = GS
- EDI Section - Data Element Name = LIN
- EDI Section - Data Element Name = SLN, Is Output Row = Yes
- EDI Section - Data Element Name = LIN
Example file:
ISA*00* *00* *14*2143981411 *12*314493968901 *180610*1239*U*00401*000895068*0*P*>
GS*SC*2143981411*314493968901*20180610*1239*1049331*X*00401
ST*832*1049331
BCT*PS**2
REF*11*314493968901
CUR*SE*USD
LIN**GS*S0931F15373430*MF*DalTile*ST*0931***SZ*18x18*MS*S0931F15373430*MN*Heathland Field
Tile Floor 18x18 PK18.00
DTM*197*20180610
REF*19**DalTile
PID*F*TRN***Heathland Field Tile Floor 18x18 PK18.00
PID*F*MAC***CERFLO
PID*F*PNA***Heathland Field Tile Floor 18x18 PK18.00
PID*F*CO***Heathland
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
MEA**SU*18*SF
CTP**LPR*1.11*1*SF
DTM*007*20180604
SLN*1**O******SK*HL0218181P2***MG*HL02*ST*0931***SZ*18x18*MS*S0931F15373430*MN*Heathland
Field Tile Floor 18x18 PK18.00
PID*F*73***RAFFIA Unpolished
PID*F*35***HL02UP
PID*F*PNA***Heathland Field Tile Floor 18x18 PK18.00
CTP**LPR*1.11*1*SF
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
LIN**GS*S0222F04110650*MF*DalTile*ST*0222***SZ*12x12*MS*S0222F04110650*MN*Salerno Deco
Accent 12x12
DTM*197*20180609
REF*19**DalTile
PID*F*TRN***Salerno Deco Accent 12x12
PID*F*MAC***CERWAL
PID*F*PNA***Salerno Deco Accent 12x12
PID*F*CO***Salerno
MEA**LN*1.00000000*EZ
MEA**WD*1.00000000*EZ
MEA**SU*9*SF
CTP**LPR*18.77*1*SF
DTM*007*20170405
SLN*1**O******SK*SL871212DECO1P2***MG*SL87*ST*0222***SZ*12x12*MS*S0222F04110650*MN*Salerno
Deco Accent 12x12
PID*F*73***UNIVERSAL Glazed
PID*F*35***SL87G
PID*F*PNA***Salerno Deco Accent 12x12
CTP**LPR*18.77*1*SF
MEA**LN*1.00000000*EZ
MEA**WD*1.00000000*EZ
SLN*1**O******SK*MH0612241P6***MG*MH06*ST*1188***SZ*12x24*MS*S1188F27456177*MN*Modern
Hearth Field Tile Floor 12x24
PID*F*73***CHIMNEY CORNER Unpolished
PID*F*35***MH06UP
PID*F*PNA***Modern Hearth Field Tile Floor 12x24
CTP**LPR*4.43*1*SF
MEA**LN*2.00000000*EZ
MEA**WD*1.00000000*EZ
LIN**GS*S0222F04110651*MF*DalTile*ST*0222***SZ*3x12*MS*S0222F04110651*MN*Salerno Deco
Accent 3x12
Example 3 – an EDI File contains multiple Products, each having one or more SKUs, with each SKU having 3 sets of Measurements (e.g, Package, Each, and Case):
- EDI Section - Data Element Name = GS
- EDI Section - Data Element Name = LIN
- EDI Section - Data Element Name = SLN, Is Output Row = Yes
- EDI Section - Data Element Name = PID (F, CAS)
- EDI Section - Data Element Name = PID (F, PKG)
- EDI Section - Data Element Name = PID (F, EA)
- EDI Section - Data Element Name = SLN, Is Output Row = Yes
- EDI Section - Data Element Name = LIN
In this example, there are 3 sibling EDI Sections below the EDI Section designated Is Output Row. This means that when these sections are encountered, they do not trigger outputting any data to the file.
Example File:
ISA*00* *00* *14*2143981411 *12*314493968901 *180610*1239*U*00401*000895068*0*P*>
GS*SC*2143981411*314493968901*20180610*1239*1049331*X*00401
ST*832*1049331
BCT*PS**2
REF*11*314493968901
CUR*SE*USD
LIN**GS*S0931F15373430*MF*DalTile*ST*0931***SZ*18x18*MS*S0931F15373430*MN*Heathland Field
Tile Floor 18x18 PK18.00
DTM*197*20180610
REF*19**DalTile
PID*F*TRN***Heathland Field Tile Floor 18x18 PK18.00
PID*F*MAC***CERFLO
PID*F*PNA***Heathland Field Tile Floor 18x18 PK18.00
PID*F*CO***Heathland
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
MEA**SU*18*SF
CTP**LPR*1.11*1*SF
DTM*007*20180604
SLN*1**O******SK*HL0218181P2***MG*HL02*ST*0931***SZ*18x18*MS*S0931F15373430*MN*Heathland
Field Tile Floor 18x18 PK18.00
PID*F*73***RAFFIA Unpolished
PID*F*35***HL02UP
PID*F*PNA***Heathland Field Tile Floor 18x18 PK18.00
CTP**LPR*1.11*1*SF
PID*F*CAS***HL02UP
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
PID*F*PKG***HL02UP
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
PID*F*EA***HL02UP
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
LIN**GS*S0222F04110650*MF*DalTile*ST*0222***SZ*12x12*MS*S0222F04110650*MN*Salerno Deco
Accent 12x12
Example 4 – Same as example 3 except the multiple sets of dimensions are at the Product level:
- EDI Section - Data Element Name = GS
- EDI Section - Data Element Name = LIN
- EDI Section - Data Element Name = PID (F, CAS)
- EDI Section - Data Element Name = PID (F, PKG)
- EDI Section - Data Element Name = PID (F, EA)
- EDI Section - Data Element Name = SLN, Is Output Row = Yes
- EDI Section - Data Element Name = LIN
In this example, since the three PID EDI Sections do not have a child EDI Section with Is Output Row = Yes, they still don't trigger the output of a data row.
Example File:
ISA*00* *00* *14*2143981411 *12*314493968901 *180610*1239*U*00401*000895068*0*P*>
GS*SC*2143981411*314493968901*20180610*1239*1049331*X*00401
ST*832*1049331
BCT*PS**2
REF*11*314493968901
CUR*SE*USD
LIN**GS*S0931F15373430*MF*DalTile*ST*0931***SZ*18x18*MS*S0931F15373430*MN*Heathland Field
Tile Floor 18x18 PK18.00
DTM*197*20180610
REF*19**DalTile
PID*F*TRN***Heathland Field Tile Floor 18x18 PK18.00
PID*F*MAC***CERFLO
PID*F*PNA***Heathland Field Tile Floor 18x18 PK18.00
PID*F*CO***Heathland
PID*F*CAS***HL02UP
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
PID*F*PKG***HL02UP
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
PID*F*EA***HL02UP
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
MEA**SU*18*SF
CTP**LPR*1.11*1*SF
DTM*007*20180604
SLN*1**O******SK*HL0218181P2***MG*HL02*ST*0931***SZ*18x18*MS*S0931F15373430*MN*Heathland
Field Tile Floor 18x18 PK18.00
PID*F*73***RAFFIA Unpolished
PID*F*35***HL02UP
PID*F*PNA***Heathland Field Tile Floor 18x18 PK18.00
CTP**LPR*1.11*1*SF
LIN**GS*S0222F04110650*MF*DalTile*ST*0222***SZ*12x12*MS*S0222F04110650*MN*Salerno Deco
Accent 12x12
Example 5 – An EDI File containing multiple Products, each having one or more SKUs but the output file is for Products only.
- EDI Section - Data Element Name = GS
- EDI Section - Data Element Name = LIN, Is Output Row = Yes
Example File:
ISA*00* *00* *14*2143981411 *12*314493968901 *180610*1239*U*00401*000895068*0*P*>
GS*SC*2143981411*314493968901*20180610*1239*1049331*X*00401
ST*832*1049331
BCT*PS**2
REF*11*314493968901
CUR*SE*USD
LIN**GS*S0931F15373430*MF*DalTile*ST*0931***SZ*18x18*MS*S0931F15373430*MN*Heathland Field
Tile Floor 18x18 PK18.00
DTM*197*20180610
REF*19**DalTile
PID*F*TRN***Heathland Field Tile Floor 18x18 PK18.00
PID*F*MAC***CERFLO
PID*F*PNA***Heathland Field Tile Floor 18x18 PK18.00
PID*F*CO***Heathland
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
MEA**SU*18*SF
CTP**LPR*1.11*1*SF
DTM*007*20180604
SLN*1**O******SK*HL0218181P2***MG*HL02*ST*0931***SZ*18x18*MS*S0931F15373430*MN*Heathland
Field Tile Floor 18x18 PK18.00
PID*F*73***RAFFIA Unpolished
PID*F*35***HL02UP
PID*F*PNA***Heathland Field Tile Floor 18x18 PK18.00
CTP**LPR*1.11*1*SF
MEA**LN*1.50000000*EZ
MEA**WD*1.50000000*EZ
LIN**GS*S0222F04110650*MF*DalTile*ST*0222***SZ*12x12*MS*S0222F04110650*MN*Salerno Deco
Accent 12x12
DTM*197*20180609
REF*19**DalTile
PID*F*TRN***Salerno Deco Accent 12x12
PID*F*MAC***CERWAL
PID*F*PNA***Salerno Deco Accent 12x12
PID*F*CO***Salerno
MEA**LN*1.00000000*EZ
MEA**WD*1.00000000*EZ
MEA**SU*9*SF
CTP**LPR*18.77*1*SF
DTM*007*20170405
SLN*1**O******SK*SL871212DECO1P2***MG*SL87*ST*0222***SZ*12x12*MS*S0222F04110650*MN*Salerno
Deco Accent 12x12
PID*F*73***UNIVERSAL Glazed
PID*F*35***SL87G
PID*F*PNA***Salerno Deco Accent 12x12
CTP**LPR*18.77*1*SF
MEA**LN*1.00000000*EZ
MEA**WD*1.00000000*EZ
LIN**GS*S0222F04110651*MF*DalTile*ST*0222***SZ*3x12*MS*S0222F04110651*MN*Salerno Deco
Accent 3x12
If the Is_Output_Row flag is set for the section, then when the data element for this section is encountered, it will trigger an output of a data row and clearing of field values, providing that data has been collected for this section. If a data element matches a parent section, then a data row is output providing data has been collected for the section with the Output Row flag, then data is cleared from the Data Row section and each parent section up to and including the section identified by the current data element.
For example, suppose the EDI specification for Example 2 above is going to generate an output file at the SKU level. When the first LIN data element is encountered, the processing will check if there is any data collected for the SLN section. Since none has, no row is output. Similarly when the first SLN data element is encountered, the processing checks to see if any SLN data has been collected – since none has, no row is output. If a subsequent element is SLN, then when the processing checks to see if SLN section data has been collected and will find that it has, so a data row is output and the data fields in the SLN section (and any child sections) are cleared. If an LIN data element is encountered, and the processing finds data in the SLN section then a row is output and the SLN and LIN data fields are cleared. If after encountering an LIN section (and the previous LIN and SLN data is output), another LIN data element is encountered, since no SLN data has been collected, no data row is generated. But the previous Product section data is cleared before saving the data for the current LIN record.
When comparing the next Data Element to the specification, the processing will first check if the Data Element matches the Qualified Data Element for the current section (indicating a loop), each of its parent sections, then any child sections. After checking for matching sections, the processing will compare against the EDI Fields defined for the current section as well as any EDI field in a parent section that have the Is Inherited flag set. This alleviates the need for all section elements to precede a nested loop but also provides a mechanism for distinguishing between an otherwise identical Qualified Data Element at the parent or child section level.