Looping through repetitive HL7 segment groups in business rule
Hi,
we get HL7 ORU messages from a laboratory system. Messages that do not contain an observation date should not be forwarded to the business operation. My problem is that the observation date can be in any repetition of the ORCgrp. How can I loop through the ORCgrps in a business rule?
.png)
Regards
Robert
Comments
I already tried the asterisk:
Length(HL7.{PIDgrpgrp(1).ORCgrp(*).OBR:7.1})>0... and the syntax with the square brackets:
Length(HL7.[OBR:7.1])>0
Hi, you might be looking for foreach action:
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cl…
And an upgrade, since the foreach action didn't exist in 2017.2 😉
This should work (no looping required):
.png)
I'm using the parenthesis syntax with the Matches() function to locate a pattern of any number of punctuation characters (.P) followed by 8 numeric characters (8N) followed by any number of any character (.E).
The parenthesis syntax returns the repeating values in the form "<><><20230512191543><>" where <> represents an empty iteration of the repeating field (and fortunately qualifies as a punctuation character).
I'm trying to do something similar, but the condition is checking the number of OBX segments in messages that can contain multiple ORC groups. The condition pasted below does not work. It also does not work if I replace the curly braces with parentheses. The only way it works is if both a PIDgrpgrp index is included and an ORCgrp index is included, and only if the outer punctuation characters are curly braces, not parentheses. We're on HealthShare version 2023.1.3.
.png)
The count syntax ("*") only works if used for the last repeating element and using curly braces, so this works:
HL7.{PIDgrpgrp(1).ORCgrp(1).OBXgrp("*")}
You need to loop in the two previous groups (PID and ORC) to get the total count of OBX segments in the message.
Thanks for the reply.
We have a custom function that was developed for a different purpose but will do what I need for the current use case. It will be a more succinct solution than using a foreach action.