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

Primary tabs


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?



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") '= ""


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:

Hi Barry, your syntax is close but not quite right:

I don't have a message class handy that has an Observation property defined as %ListOfDataTypes, so I get an error indicator in the rule editor (which I've tried, poorly, to edit out).

Hey Jeff,

I can't get the node that you have after the Document.Observation.Find with the text to search for

When i just type in the syntax, I get a compiler error.

The .Find is not really what I need to use as I want to gather all the list items.

Tried .GetAt methods, but can't seem to get anything to work.

Did you get an actual compilation error, or just an error indicator in the expression editor?

In my case, the dialog box shows the expression indicated an error, but it doesn't cause a compilation problem.

I don't have any sample messages to test with at the moment, so I'm not sure it will actually work ...

A compilation error

Going to try to write the function to loop through the fields as Marc suggested.


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:

I'll try to write a function as suggested.