Question
· Jul 14, 2017

ClassMethod Transform Count Number of OBX's Under OBR

Is there a class Method that will return the number of OBX segments under the OBR segments? I see  method ChildCountGet  and ChildCountGet is that the correct method any any examples how to use it?

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

If you're working with messages coming in from an HL7 service, the doctype will likely already be set. I only set it in my example because I used the ImportFromFile() method, which does not automatically select a schema and DocType category.

The DocType essentially defines the message object's rules use for parsing the message, so without one, you won't really be able to do much with them.

You could do some basic parsing/counting with $PIECE and some loop constructs against the raw message, but that doesn't sound like a lot of fun ...

It is a bit confusing when it comes to ORCgrp for XML Path. I have tried this one and it works well for OBR segment. Probably you can apply the similar path to OBX iteration to get what you want.

set msg = ##class(EnsLib.HL7.Message).%OpenId(id)

if (msg.GetValueAt("MSH:SendingApplication") [ "APOLLO") {

...

if (auth["AUSNATA") {

set un=msg.GetValueAt("PIDgrp.PID:PatientIDInternalID(1).ID")

set rq=msg.GetValueAt("ORCgrp(1).OBRuniongrp.OBRunion.OBR:FillerField1")

...

}

}

If you need more references for this XMLPath, try this one which I found the most useful: 
https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...