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

  • 0
  • 0
  • 71
  • 5
  • 2

Respuestas

Where is the "tval" variable defined?

That was my mistake I needed to replace tVal with tFound.

You don't need a function.

 

Length(HL7.{PIDgrpgrp().ORCgrp().OBXgrp().OBX:ObservationIdentifier.identifier},)=0

 

Best Regards.

When I feed a lab result through with OBX:3.1 valued, it is not being identified in this WHEN statement. Any other suggestions?

I don't have a PIDGrp in my structure...

I didn't notice that you have your "personal" schema category : ORUBeakerLAB