Skip to main content

Defining a Transformation Rule

This page describes how the scenario analysis module uses a transformation rule, and shows the overall syntax for a transformation rule in a template. Other pages have details on defining the preprocessor, the actual transformation code, and the call action.

How a Transformation Rule Is Used

For each call to the scenario analysis API, the system does the following:

  1. For each transformation rule in the given template:

    1. Use the preprocessor to identify changes that could be made.

    2. Use the actual transformation to generate a set of snapshots.

    The snapshots are then available for validation (the next step in the template).

  2. Later, once the scenario analysis has been resolved, the system uses the call action of the transformation rule.

Template Syntax

The following template fragment shows where to include a transformation rule:

    "transformation": {
        "name": "Replenishment Strategies",
        "rules": [
            {
                "description": "Move Inventory from Another Warehouse",
                "name": "Move Inventory",
                "type": "ObjectScript",
                "expression": "##class(Transformation.MoveInventory).MoveInventoryFromAtoB()",
                "parameters": [
                    "quantity",
                    "productId",
                    "destinationLocationId"
                ],
                "preprocessor": {
                    "expression": "WarehousePreprocessor.sql",
                    "type": "SQL",
                    "parameters": [
                        "productId"
                    ],
                    "transformationParameterIdx": 3,
                    "transformationParameter": "warehouseId"
                },
                "callAction": "CallActionForMoveInventoryBPL"
            }, ...

This example shows a transformation named Replenishment Strategies, which contains multiple rules, each of which describes a possible change that could replenish stock. Only one rule is shown here.

Formally:

  • The transformation object is a top-level property of the template. For this object:

    • name—Specifies a generic name for all the transformation rules within this object.

    • rules—Specifies an array of objects, each of which describes one transformation rule. Each transformation includes the following elements:

Checklist

FeedbackOpens in a new tab