|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Mapping Node - Find the first value in a repeating field |
« View previous topic :: View next topic » |
Author |
Message
|
jrsetters |
Posted: Thu May 10, 2012 6:15 am Post subject: Mapping Node - Find the first value in a repeating field |
|
|
 Acolyte
Joined: 24 Aug 2011 Posts: 72 Location: Cincinnati, OH
|
For an HL7 interface, we will receive multiple text segments (OBX) on resulted imaging reports. This is pretty normal for health care reporting. OBX is defined in the message set to handle this. It will look something like this:
OBX|1||&GDT|| Operative Note
OBX|2||&GDT||Patient Name: Smith, John ID: 12345
OBX|3||&GDT||
OBX|4||&GDT||Dr. Tim Taylor
OBX|5||&GDT||Appendectomy - normal
-- a bunch more OBX iterations with lines of dictated physician notes.
For one of my receiving systems, if the very first OBX (OBX|1) contains the word 'Version', this indicates a corrected report and I need to change the outbound value of another status field to reflect this.
So I want to search the first OBX and only the first OBX for the word 'Version' before making this change. I don't want to use the mapping node 'For' function, because I don't want it to loop through all of the OBX segments and perhaps find the text 'Version' in some part of the dictated report and incorrectly change my status field.
So how can I express it in the mapping node to only look at the very first iteration of this repeating field? |
|
Back to top |
|
 |
kimbert |
Posted: Thu May 10, 2012 6:30 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Which version of WMB? v8, or pre-v8? |
|
Back to top |
|
 |
jrsetters |
Posted: Thu May 10, 2012 7:12 am Post subject: |
|
|
 Acolyte
Joined: 24 Aug 2011 Posts: 72 Location: Cincinnati, OH
|
kimbert wrote: |
Which version of WMB? v8, or pre-v8? |
7.0.0.2
Right now I am trying to find it using an IF function:
fn:substring($source/tns1:TRH.ORM.ORU/tns1:OBR/tns1:OBR.2.PlacerOrderNumber/tns1:EI.1, 1, 5)='CARDO' and msgmap:occurrence($source/tns1:TRH.ORM.ORU/tns1:OBX/tns1:OBX.5.ObservationValue)=1
Maybe add another and
and fn:contains($source/tns1:TRH.ORM.ORU/tns1:OBX/tns1:OBX.5.ObservationValue, 'Version')
I am not really sure how to use the occurrence function to search for a value in 1 though. The substring function is extracting the first 5 letters of the report number because I only want to do this on cardiology reports.
Expressed more in an eSql way:
IF Ord# IN ('CARDO') AND
OBX.5 Occurence 1 IN ('Version')
Then
OBR25 = 'EDIT'
End IF
The Else will just leave the target OBR.25 set as the source OBR.25 value. |
|
Back to top |
|
 |
jrsetters |
Posted: Thu May 10, 2012 9:42 am Post subject: |
|
|
 Acolyte
Joined: 24 Aug 2011 Posts: 72 Location: Cincinnati, OH
|
This seems to work:
fn:substring($source/tns1:TRH.ORM.ORU/tns1:OBR/tns1:OBR.2.PlacerOrderNumber/tns1:EI.1, 1, 5)='CARDO' and msgmap:occurrence($source/tns1:TRH.ORM.ORU/tns1:OBX/tns1:OBX.5.ObservationValue)=1 and fn:contains($source/tns1:TRH.ORM.ORU/tns1:OBX/tns1:OBX.5.ObservationValue, 'Version')
My main concern now is whether I need to check for case on the word 'Version'. I am reasonably certain it will always come in like that, but I'd hate to see it break if it came in 'VERSION' or 'version'.
I wonder if I can a LCASE or something to my fn:contains function? |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|