Hi,
I want to write a function that can be called by the Business Rules ending (an HL7 Message Router)
I want to pass in a PID segment of an HL7 message, and based on the various patient IDs therein, return a value.
So my function looks like this:
Class IMD.Functions Extends Ens.Rule.FunctionSet
{
/// Checks if a patient exists in the IMD table
ClassMethod IsIMDPatient(pid As EnsLib.HL7.Segment) As %Boolean [ Final ]
{
$$$LOGINFO("In IsIMDPatient")
if (pid="")
{
$$$LOGERROR("Pid is empty")
}
else
{
$$$LOGINFO("Pid is NOT empty!")
}
$$$LOGINFO("Pid separators are "_pid.Separators)
set chi = ""
set crn = ""
set chi = pid.GetValueAt("3(1).1", pid.Separators, .status)
}
}
And my business routing rule (engine class EnsLib.HL7.MsgRouter.RoutingEngine) has the following condition:
IsIMDPatient(HL7.{PIDgrpgrp(1).PIDgrp.PID})
So I am trying to pass in the first PID.
The HL7 being supplied is fine.
If I change the rule to be :
HL7.{PIDgrpgrp(1).PIDgrp.PID:PatientIdentifierList(1).ID} = "whatever"
The rule executes.
When I try to use my function however, I get
ERROR <Ens>ErrBPTerminated: Terminating BP ResultRouter #514 due to error:
ERROR #5002: Cache error: <INVALID OREF>zIsIMDPatient+10^IMD.Functions.3
Whenever it tried to access any property of the PID, such as pid.Separators
is there an issue with passing a segment into a function - is that not a valid thing to do?