We use mirth for our EDI transactions. I am creating a channel for an EDI214 for a customer. I'm not really sure how to handle multiple repeated segments in the destination transformer, in specific the L11 segments. They have multiple occurrences. From the database, we fill in these segments into mirth and map a 214 document. Here is an example of a message:
`ISA00 00 ZZXXXX ZZXXXXXXX 2412191459U004010005206230P:
GSQMANTCXXXXXX202412191459520623X004010
ST214520623
B10164951F896890181*XXXX
L11XXXXX11
L11DRYVANOT
L11SOLOOT
L11XXXXXXXX12
L11172400000BM
N1SHCurrent Location
N4CATOOSAOK
LX*1
AT7X6NS**202412190659*LT
MS1CATOOSAOK*US
MS2ANTCNA
L111QN
L11172400000BM
L114500586483OT
L11BSWB17240001OT
L11IIIOT
L11LBOT
L1123332OT
L11HYPOCHLORITE SOLUTIONSOT
LX*2
AT7X6NS**202412190659*LT
MS1MUSKOGEEOK*US
MS2XXXXNA
L1199QN
L11172400000BM
L114500586483OT
L11BSWB17240001OT
L11IIIOT
L11LBOT
L1123332OT
L11TEST COMPANY NAMEOT
SE34520623
GE1520623
IEA1000520623`
At the moment, I have them filling in by index of occurence. I don't know if this will always work. Additionally, if a segment does not exist, I don't know if it will error. Am i going about this the right way?
// L11 Segment
tmp['L11'][0]['L11.01']['L11.01.1'] = tradingpartner //L11 BM
tmp['L11'][0]['L11.02']['L11.02.1'] = "11"
tmp['L11'][1]['L11.03']['L11.03.1'] = parsed_additional_information.equipment_type
tmp['L11'][1]['L11.04']['L11.04.1'] = "OT" // qualification code
tmp['L11'][2]['L11.05']['L11.05.1'] = parsed_additional_information.drivermessage
tmp['L11'][2]['L11.06']['L11.06.1'] = "OT" // number of units
tmp['L11'][3]['L11.07']['L11.07.1'] = parsed_additional_information.billingaccount
tmp['L11'][3]['L11.08']['L11.08.1'] = "12" // code for billing account
if (parsed_additional_information.BM) {
tmp['L11'][4]['L11.09']['L11.09.1'] = parsed_additional_information.BM
tmp['L11'][4]['L11.10']['L11.10.1'] = "BM" // bill of lading number
}
tmp['N1'][0]['N1.02']['N1.02.1'] = shipment_msg.from_company_name;
tmp['N3'][0]['N3.01']['N3.01.1'] = shipment_msg.from_address;
tmp['N4'][0]['N4.01']['N4.01.1'] = shipment_msg.from_city;
tmp['N4'][0]['N4.02']['N4.02.1'] = shipment_msg.from_state;
tmp['N4'][0]['N4.03']['N4.03.1'] = shipment_msg.from_zip
tmp['N1'][1]['N1.02']['N1.02.1'] = shipment_msg.to_company_name;
tmp['N3'][1]['N3.01']['N3.01.1'] = shipment_msg.to_address;
tmp['N4'][1]['N4.01']['N4.01.1'] = shipment_msg.to_city;
tmp['N4'][1]['N4.02']['N4.02.1'] = shipment_msg.to_state
tmp['N4'][1]['N4.03']['N4.03.1'] = shipment_msg.to_zip
tmp['LX'][0]['LX.01']['LX.01.1'] = "1"
how do i handle the second occurence? just index it as well?