Calculated Field Set Logic

You will use a Calculated Field Set logic when you need to:

  • Enrich/calculate data of fields of records of object types:

    • Product

    • Product Extension

    • Customer

    • Customer Extension

    • Lookup Table (Company Parameter)

    • Price Record

    • Rebate Record

    • Manual Price List

Logic API

  • Logic Nature: default

    • Logic Type: Calculation/Pricing

  • Execution Types:

    • Input Generation - to define the input fields.

    • Standard - to calculate the results (e.g., prices) and provide warnings and alerts.

  • Information provided to the logic:

    • Standard

      • sku in context - Only for objects with sku field (e.g. tables Products, Product Extension, Manual Pricelist)

      • input.Customer - Contains customerId. Only for objects with customerId field (e.g. tables Customer and CustomerExtension).

      • api.currentItem() - The data of row being enriched.

      • api.global - Contains data placed to api.global by the execution of this logic for the previous record (within one CFS calculation process).

      • Allow object modification - true. This process can update data in tables (e.g., via api.update()).

  • Expected logic execution outcome:

    • From Input Generation mode - input field definitions.

    • From Standard mode execution:

      • Result values of visible elements can be mapped to fields of the enriched object. If they’re mapped, then such result value will be stored in a field of the enriched record.

      • api.global - Data stored here will persist until the next execution of this logic for another record (within one CFS calculation process within one node).

      • when the calculation cannot proceed (e.g. because of missing data) the logic can raise an exception. Then the item will be skipped, and the exception message will be stored in a Warning field of the CFS process, where the user can find it. The CFS page also shows how many items were skipped.

Configuration

Configuration of Calculated Field Set is set up on page Administration › Calculated Field Sets, where you can set:

  • The object type to enrich.

  • A filter to select which records will be enriched.

  • The Calculated Field Set logic.

  • The mapping of which visible logic elements will be mapped to the fields of the records.

Mapping of Logic Elements Output to Data Row

In the Calculated Field Set execution process you can see, that the output of logic elements can be mapped back to the data row being processed.

This mapping is optional, and is done during the Calculated Field Set configuration.

If the Calculated Field Set mapping is configured, then after the logic finishes, the system will take the results of those visible elements, which were configured for mapping, and will copy the values back to the data row, which is currently being processed.

Common Logic Structure

  1. Build input fields.

  2. Abort on input generation.

  3. Read the current field values of the record.

  4. Read the necessary data from any tables available.

  5. Calculate new values.

  6. Expose the values via visible elements.

Code Sample

Found an issue in documentation? Write to us.

Â