Question Martin Browne · Jan 28, 2020

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

Comments

Martin Browne  Jan 28, 2020 to Enrico Parisi

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?

0
Enrico Parisi  Jan 28, 2020 to Martin Browne

I think you mistyped, the condition should be:


PostCodeLastCharacter(HL7.{PID:11(1).5})=1

Enrico

0
Martin Browne  Jan 29, 2020 to Enrico Parisi

Thanks for the help Enrico. It's working perfectly now.

Martin

0