Question
· Sep 9, 2019

Filtering messages based on OBX:3.1 being valued

We have a customer that is not able to accept HL7 result messages that are missing OBX:3.1. I have been trying to create a function that could return a boolean value of 0 if the message didn't meet the expectations of the function.

ClassMethod IsValued(pHL7Msg As EnsLib.HL7.Message, pSegment As %String, pField As %String) As %Boolean
{
            #dim tSeg as EnsLib.HL7.Segment
            
            set tSegCount = pHL7Msg.SegCountGet()
            set = 1
            Set tFound = 0
            while ((<= tSegCount) && (tval="")) {
                         
                        set tSeg = pHL7Msg.GetSegmentAt(i)
                        if (tSeg.Name = pSegment) {
                                    set tID = tSeg.GetValueAt(pField)
                                    if ($LENGTH(tID)> 0)
                                    {
                                    set tFound = 1
                                    }
                                    set = + 1

                        }
                        set = + 1
            }
            if (tFound '= "")
            {
                        1
            }
            quit 0
}

 

Am I missing something in my function? Is there a better way to do this?

 

Thanks

Scott

Discussion (7)1
Log in or sign up to continue