LinkedIn
Copied!

Table of Contents

Optimizing strategies with allow list functions

Version:

Only available versions of this content are shown in the dropdown

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 pyAllowlistFunction data transform or change the strategy logic to contain only supported functions.

Condition

In Dev Studio, you can verify which components are optimized to decide which functions you want to define as allow list functions on the strategy canvas or on the Global Optimization tab, as shown in the following figures:

Unsupported functions in strategy components
Unsupported function in a strategy component

Cause

A strategy component cannot be optimized when it contains functions that are not supported for optimization. Many of the functions available in the expression builder are already supported and can be used in a strategy component targeted for optimization. To check a list of functions supported for optimization, see Functions supported for optimization. If the function you want to use in an optimized strategy is not in the list of functions supported for optimization, investigate the strategy that you want to optimize and consider the following remedies:

Solution

  1. If the function you want to use in an optimized strategy is not in the list of functions supported for optimization, investigate the strategy that you want to optimize and consider the following remedies:

    • Change the strategy logic by using different strategy components or reconfiguring the existing ones to remove references to the functions that cannot be optimized.
    • Add the functions that cannot be optimized to the pyAllowlistFunction data transform and enable optimization for the component that uses the functions. Go to step 2.
  2. In the navigation pane of Dev Studio, click Records.

  3. Expand the Data Model category, and then click Data Transform.

  4. In the list of data transform rules, click pyAllowlistFunction.

  5. On the Definition tab, place the cursor in one of the first-level rows, and then click the Add a row button.

  6. Define the new function:

    1. From the list in the Action column, select Update Page.

    2. In the Target column, enter: .pyAllowlistFunction

    3. To propagate values from another page, from the list in the Relation column, select with values from and then enter the page name in the Source column.

    4. Add and fill in the second-level rows with the following properties:

      • .pyFunctionName
      • .pyMethodName
      • .pyLibraryName
      • .pyRuleSetName
      • .pyReturnType
      • .pyParameters
      For more information, see Data transforms.

    When you add a function to the pyAllowlistFunction data transform, ensure that you comply with the following requirements:

    • Use only the following supported parameters and return types for the new function:
      • String
      • BigDecimal
      • java.util.Date
      • double
      • Double
      • int
      • Integer
      • Boolean
      • boolean
    • Do not embed any public APIs in the function body.
    • Do not modify the StepPage in the function body.
    • Ensure that the function does not have any side effects.

    The following image shows a sample configuration of a new allow list function:

    Adding a function to the pyAllowlistFunction data transform
  7. Confirm the changes by clicking Save.

  8. Rerun the globally optimized strategy.

  9. On the Test tab of the optimized strategy, do a side-by-side comparison to see differences between non-optimized and optimized results.

  • Functions supported for optimization

    To ensure that your strategy can be optimized for better performance, use strategy components that contain only functions supported for optimization.

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.