EDI 837 Parsing
I wanted to parse an EDI 837 X12 document to extract a value from CLM segments. We tried with the below DTL and did not get it working. Appreciate any ideas.
<assign value='source.{loop2000A().loop2000B().loop2300().CLM:ClaimSubmittersIdentifier}' property='target.ClaimInvoiceNo' action='set' />
</transform>
You need to provide subscript values for the three loops.
This will give you the 1st member of each collection:
source.{loop2000A(1).loop2000B(1).loop2300(1).CLM:ClaimSubmittersIdentifier}
It's likely that in a real DTL you'll want to loop over each collection, because there will probably be multiple claims in the message. Use ForEach to do that:
<foreach property='source.{loop2000A()}' key='k2000A' >
<foreach property='source.{loop2000A(k2000A).loop2000B()}' key='k2000B' >
<foreach property='source.{loop2000A(k2000A).loop2000B(k2000B).loop2300()}' key='k2300' >
<assign value='source.{loop2000A(k2000A).loop2000B(k2000B).loop2300(k2300).CLM:ClaimSubmittersIdentifier}' property='target.ClaimInvoiceNo' action='set' />
</foreach>
</foreach>
</foreach>
Note that the way I have that now you'll end up with the last ClaimInvoiceNo in your target. You'll need to adjust to make sure you process each of them.