How can I pull a UserValues value to use in a Routing Rule suppression logic?
I have a user value set for an HL7 component that was removed from the source message. How can I pull that value for use in a Routing Rule suppression logic? Or do I have to create a custom class in order to do so?
Product version: Ensemble 2018.1
Discussion (2)1
Comments
If you create a class that extends Ens.Rule.FunctionSet, you can have a method that's selectable from the expression editor in either a DTL or a Routing Rule ...
Class User.Util.MetaData Extends Ens.Rule.FunctionSet
{
/// Retrieves the UserValue associated with key <var>pKey</var> from the message object supplied as
/// <var>pMsg</var> (normally <strong>source</strong> in a DTL or <strong>Document</strong> in
/// a Routing Rule) as a %String. Returns an empty string if the key is undefined.
ClassMethod UserValueGet(pMsg As EnsLib.HL7.Message, pKey As %String) As %String
{
If pMsg.UserValues.IsDefined(pKey)
{
Return pMsg.UserValues.GetAt(pKey)
}
Return ""
}
}Jeff -
This is perfect - thanks so much. It seems like very few places use the UserValues, so the documentation is scarce.