Question
· Feb 16, 2020

Evaluate value of repeating field in a record map within a routing rule

Created a record map to read a flat-file of lab results.

Have multiple lines that represent result components for a given order per pt MRN.

Grouping these records together based upon the order number in a custom service to create a single XML message.

Within the XML message, there are some fields that occur once and some that occur one or more times.

Within the record map, the fields/properties that occur once are configured as "As %String. The fields/properties that occur more than once are configured as "As List of %String. 

To evaluate the data that occurs once within the routing rule, can use Document.<property> e,g, Document.MRN  with no problem.

When try to do the same with the repeating fields (e.g ResultText) the value retrieved is a number followed by @%Collection.ListOfDT e.g. "9@%Collection.ListOfDT"

I've read through the doc on how to use collections and lists, and I've tried several versions, but can't come up with the right logic.

Can anyone point me in the right direction?

Discussion (8)2
Log in or sign up to continue

It's not clear what logic you want to use to evaluate the list properties, but if you want to, for example, check if any of the items in the list contain a particular value, you could use the Find() method in the class %ListOfDataTypes.

In that case the condition in your routing rule would be something like this:

Document.ResultText.Find("MyValue") '= ""

Marc,

Thanks for the reply.

What I'm trying to do is to check the contents of each record that contains value for a result component (ObservationValue) to determine if it is null or = NP so I can filter out messages that do not contain any valid results. Since the record can have one or more  ObservationValue items in the message, I need to evaluate all that exist to determine whether the record is considered valid or not.

If it were an HL7 message, these would be the OBX-5 values in a message.

In the context of a record map these are properties in the record map defined as list of %String.

Tried your suggestion searching for some text I know is found in one of the records, but I get a PROPERTY DOES NOT EXISTS error. Perhaps I have the syntax wrong. I'm positive the field I'm using is defined and named as I have used in the rule.

This is the syntax I used in the rule:

I just did a test with .Find() and was able to compile with no error and the rule executes correctly depending on the values in the inbound record. Here's what my rule looks like:

Is your router receiving the Record object from the record map or the batch object?

Since Find() doesn't meet your use case, it sounds like you'll need to loop through all of the values in that field. Routing rules can't do loops, so the right way to do this would be to create a custom function and pass it either the main Document or Document.ObservationValue. In your custom function you can iterate through the entire list and return a boolean.

Docs on creating a custom function:
https://docs.intersystems.com/healthconnect20191/csp/docbook/Doc.View.cl...