Before a logic is executed, the system will always collect a set of important information needed for the execution of the logic – referred to as Logic Calculation Context.
The actual set of information highly depends on the actual execution type, so you always have to refer to the Logic API documentation for each specific execution to find the actual set available to you.
Example of information which is often provided to the logic:
-
Binding variables provided to the logic:
-
api – Provides access to the instance of PublicGroovyAPI to be able to perform various operations within Pricefx.
-
out – Access to resulta of previous elements within the same logic.
-
libs – Access to Groovy libraries.
-
inputs – Values provided by the user.
-
-
Accessible via PublicGroovyAPI:
-
api.global – Access to cache which survive across multiple line items in line item calculations.
-
api.local – Access to cache valid for calculation of a single line item in line item calculations.
-
api.queryApi() – access to data querying functions.
-
api.currentItem(“sku”) – In line item logics, it is commonly used to provide content of the object being calculated, but in some executions it is also used to provide metadata information; some other executions might not get the information at all.
-
api.getDatamartContext() – Access to an object which provides analytical functions.
-
api.targetDate() – Date for which we perform the calculation. This date determines which version of logic be used and which Company Parameters will be looked up. This target date is always available, but its value depends on the actual use case, for example, for quotes it contains an Effective Date, i.e. the first date of validity of the quote.
-
api.isInputGenerationExecution() (isSyntaxCheck before version 10.0) – Flag defining if the execution is of this special type “input generation”. Used only for some types of logics, commonly to provide information that the logic is now expected to build input fields definitions.
-
api.isDebugMode() – Flag defining if the execution is performed in a testing mode from Pricefx Studio. This information is commonly used to mock input values from the user which are not available during the test mode, but would be available in a real execution.
-
-