Written by

Barts Health NHS Trust
Question Mary George · Dec 6, 2023

How to access a property from a collection in business rule

Hi Community, 

We are trying to filter message created using custom xml class in a business rule.  

HL7 ORU Result messages are converted to custom xml messages with a list properties .Result ORU converted to OrderResultMsg , which contains property Orders as list of Order which contains ResultStatus .  Please see below the class extract.  We are trying to access the ResultStatus property to filter non-final results via business rule. 

Class CDM.OrderResultMsg Extends Ens.Request
{

Property MSHSendApplication As %String;

Property MSHSendFacility As %String; 
<<Code truncated>>

Property Orders As list Of CDM.Order;

<<Code truncated>>

}

Class CDM.Order Extends (%SerialObject, %XML.Adaptor)
{

Property OrderControl As %String;

Property PlacerOrderNumber As %String;

Property FillerOrderNumber As %String;

Property ResultStatus As %String;

<<code truncated>>

We can get collection directly in code using ..Orders.GetAt(1).ResultStatus

In rule we tried to use Document.Orders. but haven't find a way to access the list property.  

Thanks, 

Mary

Product version: IRIS 2021.1

Comments

Enrico Parisi · Dec 6, 2023

Is Document an instance of CDM.OrderResultMsg?

If so, then Document.Orders.GetAt(1).ResultStatus should work, if not, what error you get? What is assigned to Document?

Enrico

0
Mary George  Dec 6, 2023 to Enrico Parisi

@Enrico Parisi  , It is the document variable which represents the message object from rule editor :

0
Enrico Parisi  Dec 6, 2023 to Mary George

If you type in "Document.Orders.GetAt(1).ResultStatus", does it work?

If not, what error do you get?

Enrico

P.S.: what type of rule are you using?

0
Mary George  Dec 7, 2023 to Enrico Parisi

@Enrico Parisi  We are using generic message routing rule. 

Using the GetAt call is giving Invalid binary operator error. 

Also as we could have multiple orders - result sets in the  result message we will need a way to loop in rule , which I am not sure is possible to implement in rules. 
 

0
Enrico Parisi  Dec 7, 2023 to Mary George

I don't think you can implement it in a messaging routing rule.

Personally I would implement it using code, writing a Business Process class.

Another option is using a BPL business process, but I'm not a fan of BPL. But probably that's just me. 😊

Enrico

0