Using Lists - LB and LI
I have a repeatable field within HL7 that I want to create a List from. Do I have to initialize the List by using $LB, or can I just use $LI to keep adding on to the end of the list as it is looping through the field?
Product version: IRIS 2024.1
$ZV: IRIS for UNIX (Red Hat Enterprise Linux 8 for x86-64) 2024.1 (Build 267_2U) Tue Apr 30 2024 16:06:39 EDT [HealthConnect:7.2.0-1.r1]
Discussion (0)0
Comments
USER>kill list for i=1:1:10 { set $list(list, *+1) = i } zw list
list=$lb(1,2,3,4,5,6,7,8,9,10)Is this what you're after?
do I have to call
foreach(<field>)
{
set list = $LB(<field>)
}
or can I
foreach(<field>)
{
set list= $LI(<field>,<counter>)
}I'm not familiar with HL7 processing, but I suppose should be like this
foreach(<field>)
{
set$list(list, * + 1) = <field>
}if you need to create list, than $list on the left side, with *+1 as position, to add to this list, and the right side, any value you would like to add to the list
Within a BP, you can create a Variable list, and just call
do context.<variable>.Insert(<value>) and it will add it to the list. Now that I have that piece working, I need to figure out how to extract that list so I can create some logic around it.