Homepage › Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Removing an interating OBX segment
- This topic has 15 replies, 6 voices, and was last updated 11 years, 6 months ago by Jim Kosloskey.
-
CreatorTopic
-
May 2, 2012 at 3:39 am #53073Roy OsumiParticipant
I want to remove an OBX segment from an iteration if OBX#5 is null. example inbound
OBX|1|||DATA|AA||
OBX|2|||DATA|||
would like it to look like this
OBX|1|||DATA|AA||
or
OBX|1|||DATA|||
OBX|2|||DATA|AB||
would like it to look like this
OBX|1|||DATA|AB||
Running CL5.5 Redhat 4.0
Any and all help is greatly appreciated.
– Roy
-
CreatorTopic
-
AuthorReplies
-
-
May 2, 2012 at 8:27 am #76459Robert KersemakersParticipant
Hi Roy,
I assume you are doing this from an Xlate. In your iteration you will need to check (with an IF) whether you want to (bulk)copy this segment or not.
You will also need a separate variable (%s9) to keep track of the number of OBX-segments: use this variable in your outbound message as counter for the OBX-segments. You will need to increase this variable everytime an OBX-segment is copied to the outbound message.
Hope this helps.
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands
-
May 2, 2012 at 5:29 pm #76460Roy OsumiParticipant
Thanks Robert for your help. Bulkcopy idea led me to thinking differently.
I think I figured it out using pathcopy within the iteration. I check to see if OBX#5 not null do a pathcopy.
-
May 2, 2012 at 5:35 pm #76461Jim KosloskeyParticipant
Roy,
That works for the OBX in an ORU or ORU^R01 message because the OBX segment is typically defined in the variant as optional.
However, if the target of your repetition is not specified as optional you will get empty segments as a result of doing it that way.
In the case where the target segment is not defined optinal you have 2 choices:
1. Change the variant to make the segment optional (while fast this is not always the best choice).
2. Use the technique Robert suggested. This is slower but more sure.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
-
May 3, 2012 at 7:30 am #76462Robert KersemakersParticipant
And even if the OBX-segment is optional, you would then get messages like this:
OBX|0|…
OBX|2|…
OBX|5|…
OBX|6|…
OBX|9|…
I haven’t seen a system yet that will complain about this, but it just looks weird. I want it to be this:
OBX|0|…
OBX|1|…
OBX|2|…
OBX|3|…
OBX|4|…
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands
-
May 3, 2012 at 11:08 am #76463Jim KosloskeyParticipant
Robert,
Actually I just tested this on CL 5.6:
BULKCOPY of ORU^R01 with multiple OBX segments – all segments appear as expected.
Follow BULKCOPY with PATHCOPY @null to 2nd OBX occurrence (segment level) – now second occurrence is gone as expected but all other segments are preserved.
So if the segment is optional and is either not populated at all or is nulled via PATHCOPY at the segment level, it will not appear in the outound message.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
-
May 3, 2012 at 11:14 am #76464Keith McLeodParticipant
Try something like the attached.
You basically set a counter with $%g9. Increment the $%g9 variable only when you copy an OBX/NTE grouping
Notice the destination side uses this value by using %g9 in the HL7 path notation.
Hope the attachment is visible.
-
May 3, 2012 at 12:05 pm #76465Robert KersemakersParticipant
@Jim: Yes, I understand that you can null out specific OBX-segments with a PATHCOPY, but field OBX-1 (Set ID) won’t be in a consecutive order that way. Some values (in my example 1, 3, 4, 7 and 8) will be missing because these segments are ‘deleted’. But I’m wondering if a consecutive order is necessary/required.
To make sure OBX-1 is in consecutive order, you need to use a counter, as Keith explained. Depending on the message format, you will need to use a segment counter (%s9) or a group counter (%g9).
So I think we all agree. Just wondering about that consecutive order now.
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands
-
May 3, 2012 at 12:14 pm #76466Keith McLeodParticipant
I found in most cases the order doesn’t matter, but it is the receiving system that makes that call. The benefit of not chnaging OBX:1 is that you can clearly see what was removed. But I prefer to have the numbers in order.
-
May 3, 2012 at 12:25 pm #76467Jim KosloskeyParticipant
Yup we all agree if the need is there then managing your own counter is the way to go.
Personally I always use that technique (managing the counter) no matter whether the receiving system cares or not.
I just wanted Roy to understand that his technique would not eliminate the segment if it is defined as required.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
-
May 3, 2012 at 12:30 pm #76468Keith McLeodParticipant
True.
-
June 22, 2012 at 9:15 pm #76469Carol GrossParticipant
How do I get rid of a segment in the middle of a repeating segment set?
I have tried pathcopy @null-> .0(6)OBX for example, but it leaves a placeholder
…
0(3).OBX(0) : >|4|TX|OP2.24|ORGCOM|WITH|||N|||P<
0(4).OBX(0) : >|5|TX|RL5|5|PENICILLIN-ALLERGIC |||N|||P<
0(5).OBX(0) : >|6|TX|RL6|6|TO PENICILLINS,.||||||P<
0(6).OBX(0) : ><
0(7).OBX(0) : >|8|CF|ORG8|2|STRGRB^ B^L||||||P<
-
April 10, 2013 at 7:02 pm #76470gricelda lopezParticipant
Hello,
I was able to use this thread to help me filter out OBX segments that had a negative values. My problem is that when I filter the OBX segments I still get the other OBR segments that were linked with the negative OBX segments. Any advice on how to get rid of the unwanted OBR’s?
Thanks!
-
April 10, 2013 at 7:55 pm #76471Jim KosloskeyParticipant
It depends on your reqwuirements and how you are doing your work.
Can you give us a little more information?
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
-
April 10, 2013 at 8:22 pm #76472gricelda lopezParticipant
Hi Jim,
The vendor wants me to me to strip out the OBR that has a negative OBX result out of the ORU message.
I have the loop set up in the OBX segment to filter but that doesn’t help me since I didn’t include the OBR segments into my loop and I am stuck in that part.
In the sample below, the top part is the raw message and the bottom is how the vendor wants to see it. The green high lighted portion is the positive OBX segment that I want to send to the vendor. Thank you !
-
April 10, 2013 at 9:58 pm #76473Jim KosloskeyParticipant
Gricelda,
It appears the only ORC/OBR/OBX etc you want are for those which are positive.
What I would do then is to move all of my ORC and OBR COPYs to the OBX ITERATE within the IF that determines which OBR/OBX set is to be passd on.
However if your Outbound Variant has the OBR as a required segment then any you skip will still be produced but empty – that is not what you want.
So you could define the segment as optional in the OutbOund Variant or you could manage your own counter for the ORC/OBR level thus alweays starting the set with the first ands subsequent set which has a positive result in the OBX.
If you would like to go through this in detail off-line, email me.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
-
-
AuthorReplies
- The forum ‘Cloverleaf’ is closed to new topics and replies.