Table of Contents

Article

Optimizing strategies with whitelist functions in Pega 7.4

When a globally optimized strategy cannot be optimized because its component or components contain expressions with unsupported functions, you can add the functions to the pxWhitelistfunction data transform or change the strategy logic to contain only supported functions.

Unsupported function in a strategy component

Unsupported function in a strategy component

Cause

A strategy component cannot be optimized when it contains functions that are not whitelist functions. The following functions and the functions that are listed in the pxWhitelistFunction data transform are whitelist functions.

FunctionRulesetLibraryParameters
dividePega-RULESMath(BigDecimal::dividend, BigDecimal::divisor)
todayPega-RULESDateTimeN/A
normalPega-DecisionEngineRandomN/A
normalPega-DecisionEngineRandom(double::mean, double::sd)
randomPega-DecisionEngineRandomN/A
randomPega-DecisionEngineRandom(double::min, double::max)
andN/AN/A(boolean::param...)
orN/AN/A(boolean::param...)
getDatePega-RULESDateTime(String::strStamp)
DateTimeDifferencePega-RULESDateTime(String::beginTime, String::endTime, String::strPrecision)
ifN/AN/A(boolean::condition, then, otherwise)

The pxWhitelistFunction data transform

Example of a function that can be optimized in globally optimized strategies

Solution

Investigate the strategy that you want to optimize and consider changing the strategy's logic. You might need to use different strategy components or reconfigure the existing ones to remove references to the functions that cannot be optimized. Alternatively, it might be possible to add these functions to the pyWhitelistFunction data transform that is applied in the pxWhitelistFunction data transform and enable optimization for the component that uses the functions.

Adding a new whitelist function

  1. In Designer Studio, open and overwrite the pyWhitelistFunction data transform.
  2. In the Action column, select Update Page and specify source values for the following targets:

    • .pyFunctionName

    • .pyLibraryName

    • .pyRuleSetName

    • .pyParameters(<APPEND>)

    Overwriting pyWhitelistFunction data transform

    Adding a function to the pyWhitelistFunction data transform

  3. Save your changes and rerun the globally optimized strategy.
  4. On the Test tab of the optimized strategy, do a side-by-side comparison to see differences between nonoptimized and optimized results.

When you add a function to the pyWhitelistFunction data transform, consider these requirements:

  • The parameters and the return type of the function must be of the following type: String, BigDecimal, java.util.Date, double, Double, int, Integer, Boolean, or boolean.
  • The body of the function cannot contain any Public API.
  • StepPage in the body of the function cannot be modified.
  • Function must not have any side effects.

Published June 2, 2017 — Updated September 24, 2018

Related Content

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.