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.
{
Property MSHSendApplication As %String;
Property MSHSendFacility As %String;
<<Code truncated>>
Property Orders As list Of CDM.Order;
<<Code truncated>>
}
{
Property OrderControl As %String;
Property PlacerOrderNumber As %String;
Property FillerOrderNumber 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
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
@Enrico Parisi , It is the document variable which represents the message object from rule editor :
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?
@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.
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