Written by

Sr Application Development Analyst at The Ohio State University Wexner Medical Center
Question Scott Roth · Mar 4

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]

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?

0
Scott Roth  Mar 4 to Dmitry Maslennikov

do I have to call

foreach(<field>)
{
  set list = $LB(<field>)
 }
 

or can I 

foreach(<field>)
{
 set list= $LI(<field>,<counter>)
}
0
Dmitry Maslennikov  Mar 4 to Scott Roth

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

0
Scott Roth  Mar 4 to Dmitry Maslennikov

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.

0