Logic Structure

Within a Pricefx source directory (package), logics reside in the CalculationLogic and WorkflowFormula directories. Each logic consists of a few script files and metadata.

Figure 1. The file structure for a logic.

Logic Properties

Metadata for logics are defined by the logic.json file. There are three mandatory properties: uniqueName, validAfter, and status.

uniqueName

Used to reference logics

validAfter

Used to schedule releases

status

Used to activate and deactivate logics

These three properties make up a composite primary key.

Logic Element Properties

The logic.json file also contains a property elements. This property is an array of objects, where each object references one script inside the elements/ directory. These scripts — together with the associated metadata — make up an element.

Calculation Logic

{ "uniqueName" : "MyLogic", "validAfter" : "2021-09-28", "status" : "ACTIVE", "elements" : [ { "elementName" : "Cost", ... }, { "elementName" : "Markup", ... }, { "elementName" : "ListPrice", ... }, { "elementName" : "Margin", ... } ] }

There are many other valid properties in the logic.json file. Price Studio helps you to maintain a valid structure by providing a visual editor.

Figure 2. Pricefx Studio provides a graphical user interface for editing the `logic.json` file.
{ "elements" : [ { "allowOverride" : false, "combinationType" : "FUNCTION", "displayOptions" : 0, "elementGroups" : [ ], "elementName" : "GenerateInputs", "elementTimeout" : 0, "hideOnNull" : false, "hideWarnings" : false, "summarize" : false }, { "allowOverride" : false, "combinationType" : "FUNCTION", "displayOptions" : 0, "elementGroups" : [ ], "elementName" : "CalculateResults", "elementTimeout" : 1000, "hideOnNull" : false, "hideWarnings" : true, "summarize" : false }, { "allowOverride" : false, "combinationType" : "FUNCTION", "displayOptions" : 16, "elementGroups" : [ ], "elementLabel" : "Currency", "elementName" : "Currency", "elementTimeout" : 0, "formatType" : "TEXT", "hideOnNull" : false, "hideWarnings" : false, "summarize" : false }, { "allowOverride" : false, "combinationType" : "FUNCTION", "displayOptions" : 16, "elementGroups" : [ ], "elementLabel" : "Markup (%)", "elementName" : "MarkupPct", "elementTimeout" : 0, "formatType" : "PERCENT", "hideOnNull" : false, "hideWarnings" : false, "summarize" : false }, { "allowOverride" : false, "combinationType" : "FUNCTION", "displayOptions" : 16, "elementGroups" : [ ], "elementLabel" : "Markup", "elementName" : "MarkupAbs", "elementSuffix" : "Currency", "elementTimeout" : 0, "formatType" : "MONEY", "hideOnNull" : false, "hideWarnings" : false, "summarize" : false }, { "allowOverride" : false, "combinationType" : "FUNCTION", "displayOptions" : 16, "elementGroups" : [ ], "elementLabel" : "List Price", "elementName" : "ListPrice", "elementSuffix" : "Currency", "elementTimeout" : 0, "formatType" : "MONEY", "hideOnNull" : false, "hideWarnings" : false, "summarize" : false } ], "status" : "ACTIVE", "uniqueName" : "Example_Logic", "validAfter" : "2000-01-01" }

Found an issue in documentation? Write to us.

Â