Question
· Mar 23, 2021

Using ChildCount from EnsLib.HL7.Message to get repeatable fields

A while back I asked the developer community for a way to loop through repeatable HL7 segments and check them against a Data Lookup table within a Business Rule.

The example I got was the following...

ClassMethod GroupIDExists(pHL7Msg As EnsLib.HL7.Message, pSegment As %String, pField As %String, pLookupTable As %String) As %Boolean
{
            #dim tSeg as EnsLib.HL7.Segment
            set tSegCount = pHL7Msg.SegCountGet()
            set i = 1
            Set tFound = 0
            //get new values
            set tval=""
            while ((i <= tSegCount) && (tval="")) {
                        set tSeg = pHL7Msg.GetSegmentAt(i)
                        if (tSeg.Name = pSegment) {
                                    set tID = tSeg.GetValueAt(pField)
                                    set tval= ..Lookup(pLookupTable, tID)
                       }
                        set i = i + 1 
            }
            if (tval '= "")
            {
                        Q 1 
            }
            quit 0
}

While this works perfect when you have RGSgrp or a OBXgrp because it is using SegCountGet(), our team is looking to take that a bit further. What if we wanted to loop through OBR.4() and compare it to a Data Lookup table within a Business Rule.

  • Could I go about doing this by using ChildCount() in EnsLib.HL7.Message?
  • Or how would I go about getting the count of a Field within a segment to loop through?

Thanks

Scott

Product version: HealthShare 2018.1
$ZV: Cache for UNIX (IBM AIX for System Power System-64) 2018.1.3 (Build 414U) Mon Oct 28 2019 11:24:02 EDT
Discussion (1)1
Log in or sign up to continue