How do I pass an aux.RuleUserData unique value for each individual routing rule?

Ensemble

Hi,

I have two rules within a single rule set where I am wanting to set a variable (RuleUserData)  (MGH & MGP) to pass into the transform called for each rule. However, the RuleUserData value (MGP) defined in the last rule is being passed in the first rule and into the transform. It appears the last RuleUserData value is utilised for any rules in the entire rule set where as I want to pass  the assigned data for each individual rule into the transform being called. Is there any way of doing this outside of using context variables from a BPL?

Also can the Temporary Variables defined at the start of the rule set be called within each rule? Could this be of some help? I know they do not pass data onto the transformation though.

Thanks :)


<ruleDefinition alias="" context="EnsLib.HL7.MsgRouter.RoutingEngine" production="">
<variable name="MGH"></variable>
<variable name="MGP"></variable>
<ruleSet name="" effectiveBegin="" effectiveEnd="">


<rule name="Rule 1 - To LSC PAS Router" disabled="false">
<constraint name="msgClass" value="EnsLib.HL7.Message"></constraint>
<constraint name="docCategory" value="Generic.2.3.1"></constraint>
<constraint name="docType" value="GENERIC"></constraint>
<when condition="1">
<send transform="" target="LSCPASRouter"></send>
</when>
</rule>


<rule name="Rule 4 - Send A28/A31/A36 messages to MGHPASRouter" disabled="false">
<constraint name="msgClass" value="EnsLib.HL7.Message"></constraint>
<constraint name="docCategory" value="Generic.2.3.1"></constraint>
<constraint name="docType" value="GENERIC"></constraint>
<when condition="(Document.{MSH:MessageType.triggerevent}=&quot;A28&quot;)||(Document.{MSH:MessageType.triggerevent}=&quot;A31&quot;)||(Document.{MSH:MessageType.triggerevent}=&quot;A36&quot;)">
<assign property="RuleUserData" value="&quot;MGH&quot;"></assign>
<send transform="SAH.Common.HL7.Transform.Message.Genericv231ToFacilityConversionDTL" target="MGHPASRouter"></send>
</when>
</rule>
<rule name="Rule 5 - Send A28/A31/A36 messages to MGPPASRouter" disabled="false">
<constraint name="msgClass" value="EnsLib.HL7.Message"></constraint>
<constraint name="docCategory" value="Generic.2.3.1"></constraint>
<constraint name="docType" value="GENERIC"></constraint>
<when condition="(Document.{MSH:MessageType.triggerevent}=&quot;A28&quot;)||(Document.{MSH:MessageType.triggerevent}=&quot;A31&quot;)||(Document.{MSH:MessageType.triggerevent}=&quot;A36&quot;)">
<assign property="RuleUserData" value="&quot;MGP&quot;"></assign>
<send transform="SAH.Common.HL7.Transform.Message.Genericv231ToFacilityConversionDTL" target="MGPPASRouter"></send>
</when>
</rule>
</ruleSet>
</ruleDefinition>

  • 0
  • 0
  • 87
  • 2
  • 1

Answers

Hi David,

The ruleset including assign actions are evaluated before the send actions.

In this instance, if both rules are true then the first assign will be overwritten by the second assign, before both send actions are processed.

I guess you could work around this by having two different property names and testing for the existence of a value in the DTL.

It feels like there is a better solution altogether to suggest, but its not clear what the real world use case is here.

Sean.

 

 

Comments

Thanks very much Sean. Pity the assign action is not unique for each rule. I would like to see that ability in a future release. 

Essentially I am trying to send the same message to seperate targets using the same DTL but assigning a different value MGH or MGP to specific target  HL7 fields (e.g. SendingFacility). These values don't exist in the source message. Not sure if I can do this within a single DTL 

I know I can do it with multiple DTLs but I don't want to have multiple copies of the same DTL.

For now I would like to find a solution doing it this way but ultimately I think I will need to create a BPL to handle this effectively.  Thanks.

You can access the rule name with aux.RuleReason in the transform which provides a way to pass in a delimited value.

Another option is to chain transformations together within the same send action. So you could have a second transformation for each target that does nothing but assign a hard coded value such as MGH and MGP to your facility codes.

To chain the transformations just select a second transformation from the data transform selector, or just add the name of the transformation in a comma delimited list, e.g.

SAH.Common.HL7.Transform.Message.Genericv231ToFacilityConversionDTL,SAH.Common.HL7.Transform.Message.AddMGH

SAH.Common.HL7.Transform.Message.Genericv231ToFacilityConversionDTL,SAH.Common.HL7.Transform.Message.AddMGP