Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Calling a Function from the WHEN directive in a Business Rule specification

Question
Chip Gore · Oct 29, 2021

Calling a Function from the WHEN directive in a Business Rule specification

In specifying a "WHEN" condition statement, I don't seem to be able call a function directly from this declaration, as the generator seems to get confused

In the graphical editor:

%request.GetValue("MRN"))=123453

(%request.GetValue("MRN"))=123453)

In the DTL directly: 

<when condition="(%request.GetValue(&quot;MRN&quot;))=123453)">

<when condition="(%request.GetValue&#40;&quot;MRN&quot;&#41;)=123453)">

 

But they all fail at the same point, where the opening "(" of the method call completely confuses the generator, and these all throw the same error:

ErrParsingExpression: Error parsing expression '(%request.GetValue("MRN"))=123453)': ERROR <Ens>ErrInvalidToken: Invalid token at offset 19

 

The request class type DOES have an instance method called GetValue() that takes a single string parameter

The ultimate int code I'm trying to generate should look something like this:

((pContext.%request.GetValue("MRN"))=(123453))

Which SHOULD be ok.

My question is, is there any syntax for making a function call in the WHEN clause?

#DTL #InterSystems IRIS
Product version: IRIS 2021.1

Source URL:https://community.intersystems.com/post/calling-function-when-directive-business-rule-specification