Question
· Mar 19

Expanding 1 HL7 segment into multiple based on interger value from a lookup table mapping

I have a HL7 DTL in which I'm doing a lookup to a table based on a code value in the IN1:3 field.  That incoming code may have a 1 to 1 mapping, or 1 to many mapping in a table.  If it's a 1 to many, the values in the lookup table are comma delimited.  If it's 1 to 1, that IN1 segment will map straight across.  If it's one to many, I need to create additional IN1 segments.  For example, if the incoming code maps to three, I need to map the original IN1 segment with one of the mapped codes, then create two additional IN1 segments with the other 2 codes for a total of 3 IN1 segments.  I'd like to do this with a loop.  I can get the number of segments I need with:

..Length(insurancePlanIDs,",")

and putting the number in a variable.  However, the ForEach in the DTL will only work with a collection as opposed to just a variable that contains the number 3, for example.  I can use the PIECE function to get each code out, so that's not an issue.  As mentioned, I'm not sure how to get the looping to work within the DTL.  With other programming languages, I could just use a for or while loop and iterate over that integer variable, but I'm struggling with how to create a loop with just an integer variable.

Any help is appreciated. 

Product version: IRIS 2023.1
Discussion (2)2
Log in or sign up to continue