Complex Example of Using Indexes
In this example, on the Input side of the map you receive an SAC segment that repeats 25 times. The SAC segment is a child to a repeating SLN group. The SLN group is a child to a repeating IT1 group, which puts the SAC segment three hierarchical levels deep on the Input side of the map.
Additionally, you only want to map the contents of the SAC segment if the SAC05 (Price) element is not equal to zero. Finally, the Output structure of the map is at the same hierarchical level as the input structure.
Following is a sample of the repeating structure that you receive in the input file:
IT1*1*****SH*Service is Requested
SLN*1**O
SAC*S**AB**0****EA*0***Service**Service
SAC*S**AB**500.00****EA*20***Service**Service
SAC*S**AB**0****EA*23***Service**Service
SAC*S**AB**121.11****EA*10***Service**Service
SLN*2**O
SAC*S**AB**0****EA*50***Service**Service
SAC*S**AB**250****EA*2***Service**Service
IT1*2*****SH*Service is Requested
SLN*1**O
SAC*S**AB**0****EA*24***Service
SAC*S**AB**45.67****EA*200***Service
SAC*S**AB**0****EA*78***Service**Service
SAC*S**AB**222.74****EA*103.789***Service
On the Input side of the map, you have created a temporary repeating segment (TEMP_SAC) to receive the SAC information for those segments where the Price is not equal to zero, and you have linked the TEMP_SAC segment to the Output side of the map.
Now, you want the translator to create the following array:
Loop Hierarchical Structure | Occurrence | Data |
---|---|---|
First IT1, First SLN, First TEMP_SAC | 1,1,1 | SAC*S**AB**500.00****EA*20***Service**Service |
First IT1, First SLN, Second TEMP_SAC | 1,1,2 | SAC*S**AB**121.11****EA*10***Service**Service |
First IT1, Second SLN, First TEMP_SAC | 1,2,1 | SAC*S**AB**250****EA*2***Service**Service |
Second IT1, First SLN, First TEMP_SAC | 2,1,1 | SAC*S**AB**45.67****EA*200***Service |
Second IT1, First SLN, Second TEMP_SAC | 2,1,2 | SAC*S**AB**222.74****EA*103.789***Service |