How can I read a field from the second obx segment using objectscript

Primary tabs

Hi, I am trying to read a field from the second obx segment but it keeps giving me an error.

Following is what I am trying:

detval = pRequest.FindSegment("OBX(2)")
dep = detval.GetValueAt(2)

but it doesnt read it. Is there a different way to read the value?

Replies

Hi Eric,

In ORM messages the property path is:

"ORCgrp(<indexORC>).OBRuniongrp.OBXgrp(<indexOBX>).OBX"

Where <indexORC> is the "line" of ORC segment, the <indexOBX> is the same to OBX segment, generally we iterate over a loop.

In ORU messages the property  path is:

"PIDgrpgrp(<indexPID>).ORCgrp(<indexORC>).OBXgrp(<indexOBX>).OBX"

Then indexes variables is analogous to the ORM messages.

The easy way to you "discover" the property  path is creating a DTL data transformation  and map the property that you need in a fake assign action, save, compile and change to the generated routine (in studio use the shortcut Ctrl+Shift+V, 2 times)

Hi Cristiano, Thank you so much,  I tried that too, but always returns blank.

pRequest.GetValueAt("PIDgrpgrp(1).ORCgrp(1).OBXgrp(2).OBX:6"). Is my syntax wrong?

It's correct, you can use index or name of a field.

Are you sure about the value of a field?

Could you post the entire HL7 message?

I want to get the value 110 from the OBX2 SEGMENT

Eric,

The problem is that ensemble do not recognized your Message Type, then in this case you can only access properties by Index.

In your case is segment 9 field 6: 

pRequest.GetValueAt("9:6")

To see the problem call the method GetValueAt and log the status code:

Do pRequest.GetValueAt("PIDgrpgrp(1).ORCgrp(1).OBXgrp(2).OBX:6", , .statusCode)

$$$LOGSTATUS(statusCode)

See de documentation for mor detail about message schema:

https://docs.intersystems.com/irisforhealthlatest/csp/docbook/Doc.View.cls?KEY=EHL72_tools
 

spot on Cristiano.  I will need to find a way to identify the segment and get the value. Thank you so much.

You can set in the Business Service the Setting: MessageSchemaCategory and then the Ensemble will recognize your message and map all properties.

I hope be helped you.