Regular Calculation Dataload Logic

You will use a Calculation Dataload logic when you need to:

  • Enrich/process a Datamart, Data Source or Data Feed, for example to:

    • Add new records - copy and transform data from other table to this table.

    • Modify existing records - pre-calculate values, which were not imported from an external system, but are needed for analysis and their calculation takes too long to be done on demand.

Logic API

  • Logic Nature: paDataLoad

    • Logic Type: Calculation/Pricing

  • Execution Types - Four types, which are a combination of the element calculation context (element group) and input generation/standard execution. You do not have to use all the four types, in many cases you will be using only one or two.

    • "row" group in input-generation mode - To build input fields, which will be used during configuration of the process. Only code of elements in the "row" group will be executed during this execution.

    • "init" group in standard mode - To process the table as a whole. You can add/modify/delete records. Only code of elements in the "init" group will be executed during this execution.

    • "row" group in standard mode - To process one single row, calculate the results (e.g., prices) and provide warnings. Only code of elements in the "row" group will be executed during this execution.

    • "summary" group in standard mode - To process the table as a whole. You can add/modify/delete records. Only code of elements in the "summary" group will be executed during this execution.

  • Information provided to the logic:

    • To "init" group in standard mode:

      • api.targetDate() - It will be the one set in the Data Load configuration, or today.

      • api.getDatamartRowSet("source")

      • api.getDatamartRowSet("target")

    • To "row" group in "standard" mode:

      • Sku can be in context, if the mapping was set in Dataload configuration.

      • api.targetDate() can be dynamic, if set in the Data Load configuration, otherwise will be the one set in the configuration or today.

      • input[]

        • It will contain "mapped parameters" - values from fields of the source rowset data row being enriched. The mapping between the source fields and login inputs is set in the configuration of the Data Load process.

        • Or it will potentially contain "fixed parameters", i.e., overridden by the value entered by the user to the input field in the configuration of the Data Load process.

      • api.currentItem() - A view on the Data Load definition (object DMDataLoad, which holds the Data Load task configuration).

      • api.getDatamartRowSet("source")

      • api.getDatamartRowSet("target")

    • To "summary" group in standard mode:

      • api.targetDate() - It will be the one set in the Dataload configuration, or today.

      • api.getDatamartRowSet("source")

      • api.getDatamartRowSet("target")

  • Expected logic execution outcome:

    • From "row" group in input-generation mode:

      • Input field definitions

    • From "init" group in standard mode:

      • Element warnings will be placed to a log into Warn category.

    • From "row" group in standard mode:

      • Results of visible logic elements, which are configured in Data Load result mapping, will be copied by system to the data row, which will be inserted to the target rowset.

      • Logic warnings will end up in the log file under Warn category.

      • If the target rowset has the field "warnings", the warning messages will be stored there.

      • If the target rowset has the field "alerts", the alerts messages will be stored there.

      • If the target rowser has the field "formulaResult" and there was no critical alert, the field will have the value "OK".

    • From "summary" group in standard mode:

      • Raised Warnings will appear in the log file as WARN category.

      • Results of visible elements are stored into the Data Load definition (DMDataLoad) itself into the field calculationResults.

Common Logic Structure

  • Elements of init elements group.

  • Elements of row elements group, which build the input fields.

  • Elements of row elements group, which calculate the values for the target rowset.

  • Elements of summary elements group.

Code Sample

Found an issue in documentation? Write to us.

Â