Question
Pascal Dietvorst ICT BV
NL
Last activity: 8 Nov 2024 6:23 EST
How to resolve an expression from a String
In Short
I'm trying to apply the OOTB activity pzEvaluatePegaExpression
, but I cannot find or access it. Why?
The Longer Version I have a situation where a string containing a Pega expression is read at runtime, and I need to resolve it to its value. This seems straightforward, seeing how Pega does this all the time, but I cannot find a way to do it from a data transform or activity.
For example
A data transform reads the definition of a decision table (Rule-Declare-DecisionTable
) and finds that the definition for the first column (value of .pyColumns(1).pyProperty
) is the string @callWhen(tools,"TheWhenRule",.ExamplePage.ExampleProp)
.
The data transform then needs to resolve this expression to its True/False outcome.
Analysis Tracing Pega rules does not reveal this level of detail, as far as I can see. However, the same function occurs when testing an expression in the expression builder. Using the browser's developer tools shows the following network traffic on change of the input for a tested expression in the builder:
In Short
I'm trying to apply the OOTB activity pzEvaluatePegaExpression
, but I cannot find or access it. Why?
The Longer Version I have a situation where a string containing a Pega expression is read at runtime, and I need to resolve it to its value. This seems straightforward, seeing how Pega does this all the time, but I cannot find a way to do it from a data transform or activity.
For example
A data transform reads the definition of a decision table (Rule-Declare-DecisionTable
) and finds that the definition for the first column (value of .pyColumns(1).pyProperty
) is the string @callWhen(tools,"TheWhenRule",.ExamplePage.ExampleProp)
.
The data transform then needs to resolve this expression to its True/False outcome.
Analysis Tracing Pega rules does not reveal this level of detail, as far as I can see. However, the same function occurs when testing an expression in the expression builder. Using the browser's developer tools shows the following network traffic on change of the input for a tested expression in the builder:
- Validate input
- Create top-level pages for simulating expression execution (
pzActivity=pzCreateTopLevelPages
) - Evaluate the expression (
pzActivity=pzEvaluatePageExpression
) - Display results
So, what I need (I think) is to access or reproduce the functionality that Pega uses in the third step of this on-change action. The payload for this third step is:
- pyActivity: pzRunActionWrapper
- pzActivity: PegaGadget-ExpressionBuilder.pzEvaluatePegaExpression
- skipReturnResponse: true
- pySubAction: runAct
- pegaExpression: [The expression]
- stepPageClass: [The step page's class]
- pzPrimaryPageName: [Step page reference]
- eventSrcSection: @baseclass.pzFieldsInExpressionBuilder
Problem
The activity pzEvaluatePegaExpression
—which is used by the expression builder—cannot be found within Pega. Apparently, this is part of a layer of the Pega engine that is reserved exclusively for Pega.
Question How can I leverage Pega's capability to resolve an expression from a string at runtime?
Related executing-function-statement-string-property