Using $EXTRACT function in routing rule
Hi,
I'm attempting to use the $EXTRACT function in my routing rule but I'm seeing 'Expression Parsing' error messages when trying to save the rule.
I want to check the last character of a post code by using the following code:
$EXTRACT(HL7.{PID:PatientAddress(1).ziporpostalcode},*)="Z"
Could anyone assist with this?
Thanks,
Martin
Hi Martin,
whenever you have a "special need" (not saying that $e() is special...but..) in rules or DTL, you can create a Custom Utility Function, see:
https://cedocs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?K...
Get back if any problem arise writing the function.
HTH
Enrico
Thanks Enrico,
I've written the custom function...
ClassMethod PostCodeLastCharacter(PID11 As %String)
{
Set ReturnValue = 0
if ($EXTRACT(PID11,*) = "Z")
{set ReturnValue = 1 }
Quit ReturnValue
}
I've added a trace to my rule which returns the relevant 1 or 0 (depending on the post code). However, my rule condition which references the function doesn't trigger an message...
PostCodeLastCharacter(HL7.{PID:11(1).5}=1)
Have I got the syntax correct?
I think you mistyped, the condition should be:
PostCodeLastCharacter(HL7.{PID:11(1).5})=1
Enrico
Thanks for the help Enrico. It's working perfectly now.
Martin