Check repeating segments in a rule for value of "-"
I need to create a routing rule where I've got to check for the value of "-" in field 5 of a repeating RQD segment, if the "-" is found in any of the RQD-5 I want to send it to a transform, if the rule doesn't find a "-" in any of the RQD-5 I want to send it to another transform.
Unfortunately we are running an older version of Ensemble and the foreach function is not available.
The other thing to add is the transforms are writing the output to a flat file so my business process is using the EnsLib.MsgRouter.RoutingEngine class.
Sample message:
ORC|NW|5139|||||||20230620161500|78068^TEST^TOM^^||43865^TEST^PHYSICIAN^^|1259^11800004
RQD|1|124128|0137^GUIDE CATH|0137^GUIDE CATH|-1||1259^CV CATH/EP||619^PERP|20230620
RQ1|40|SONIC AVE|LA7HS2SH||0137|
ORC|NW|5139|||||||20230620161500|78068^TEST^TOM^^||43865^TEST^PHYSICIAN^^|1259^11800004
RQD|2|138030|0537^COIL 400 COMPLEX STD|0537^COIL 400 COMPLEX STD|1||1259^CV CATH/EP||619^PERP|20230620
RQ1|2025|PUMA|4002C0610||0537|
Any help is greatly appreciated.
I have absolutely nothing to do with health and HL7 etc. except I know, they exists but the $length(string,delimiterstring) function will you always tell, how many subfields a string has for a given delimiter string.
write $l("","-") --> 1 write $l("abc-def","-") --> 2 write $l("abc-","-") --> 2 write $l("abc-def-ghi","-") --> 3 etc.
Hi Doug,
Have you considered creating a new Rule FunctionSet.
This would then appear in as a new available function in Rule Editor when compiled.
For example:
If you were to use the Parenthesis () Syntax in your routing rule, you could simply make your rule something like:
The reason this works is that using the parenthesis syntax to access repeating values from a message will return all of the entries in the repeating segment as a *delimited string, and you can then check the string contains the - character using the contains function.
*Do make sure that the delimiter isn't the character you're looking for. Maybe throw in a trace when you first test this and check how it's returned.
Thank you for the suggestions