Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
|
You’re using Pricelist logic Price list logics are used when you need to:
build Build input field definitions for the a price list.
calculate Calculate results of the for price list items
...
.
Logic Selection
When a pricelist price list item is about to be calculated, the engine will select the selects a logic based on certain criteria. Besides the standard things, like factors (if the logic is active and valid for a target date), there are also the following rules, which logic will be used (. (If more logics satisfy the criteria, the first one available will be is used.)
product Product specific logic
logic selected in Pricelist definition.if If the product has a logic defined (in the Product table), this one will be it is used. Using of this type of logic can be switched off by advanced configuration option doNotUsePerProductFormulasInLists
Advanced Configuration Option doNotUsePerProductFormulasInLists.
Logic selected in the price list definition
This logic can be pre-filled from the PricelistType Price List Type (if it was used by user),.
but could It can be also set by a user.
default Pricelist Default price list logic
defaultsee advanced configuration option defaultPLFormula
See Advanced Configuration Option defaultPLFormula.
Default generic logic
see advanced configuration option defaultFormulaSee Advanced Configuration Option defaultFormula.
Logic API
Logic Nature: default
Logic Type: Calculation/Pricing
Execution Types:
Syntax Check - to define Input Generation – Defines the input fields for the Pricelist price list (i.e. NOT on the item).
Standard - to calculate – Calculates the results (e.g. prices) and provide provides warnings and alerts for each item.
Information provided to the logic:
in In the Syntax Check Input Generation mode:
sku SKU in the logic context
in In the Standard mode:
sku SKU in the logic context values - available via
api.product("sku")
Values of all inputs provided by the user - available via
input["inputName"]
api.currentItem
has()
provides PricelistItem as Map, but only BUT ONLY in the 2nd (and next) passes of the multi-pass calculation. I.e. in normal calculation, it will have nothingNOT contain it.api.global
- containspreviousContext()
- when calculating a revision of a pricelist, this gives you data of the previous version of the PLI line (from the previous pricelist version)api.global
– Contains data placed to api.global by previous execution of this logic for the another line (within one pricelist price list calculation process).
Expected logic execution outcome
from Syntax Check mode - input field definitions
from From Input Generation mode:
Input field definitions (stored in logic context)
From Standard mode execution:
Calculation result values (and formatting) of the visible logic elements will be copied by the system to the attributeX fields of the PricelistItem
api.global
- data must be provided via output of logic elements which are set as visible (either Display Mode Pricelist or Everywhere). Formatting is provided via setting of the logic element. The result value could be of many types, e.g. number, text, ResultMatrix, Chart (either Analyzer chart or Highchart).Warnings
Alerts
api.global
– Data stored here will persist until the next execution of this logic for another line (but only within one pricelist price list calculation process within one node).
:
Common Logic Structure
build Build input field definitions.
abort on syntax check
calculate the Abort on input generation.
Calculate prices and other values.
Mapping of
logic results to PricelistLogic Results to Price List Item (PLI)
When the item The mapping is set during the setup of the Pricelist (i.e. done partially by the business user)
During the process of pricelist calculation, the system will take an SKU to calculate, puts it to the context and runs the logic. When the logic finishes the calculation, the results of the elements are mapped and copied system does various mappings:
it takes values of some fields from Products table and puts them to the PLI
To be able to use the logic result on the PLI:
it takes the values of visible logic elements (but only those allowed by user during pricelist setup) and maps and copies them to the fields of the PLI object.
if the pricelist setup also has some additional mappings (Result Price, Currency, Unit Of Measure), the system will do those mappings too.
Output Elements Mapped to Attribute# Fields
the The business user selects which visible elements they want to map to PLI - – when creating the Pricelist on the New Price list Definition dialog on a new price list (step Parameters, in part section Output Elements).
if If you need to enforce that certain elements to be are always mapped (i.e. so the user cannot unselect them), use the advanced configuration option mandatoryPLElementsThe mapping Advanced Configuration Option mandatoryPLElements.
Mapping of selected element results to the PLI’s PLI attribute# fields is done automatically, but if you need, you can set specific elements to be mapped to specific attributes - see advanced configuration option calculableObjectPreferredMapping– see Advanced Configuration Option calculableObjectPreferredMapping.
Special Logic Results Mapping
On In the dialog New Price List Definition , step dialog in the Set Parameters step, the user can also specify , which element result will end up in PLI’s fields:
calculatedResultPrice - – setting Result Price
unitOfMeasure - – setting Dynamic UOM
currency - – setting Dynamic currency
Warnings Mapping
The warnings collected from the output elements, will be stored in Warnings field of the PLI.