Before a Logic logic is executed, the system will always collect a set of important information needed for the execution of the logic - – referred to as the 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 Binding variables provided to the Logiclogic:
api - provides – Provides access to the instance of PublicGroovyAPI , to be able to perform many various operations within Pricefx engine.
out - access – Access to result resulta of previous elements within the same logic.
libs - access – Access to Groovy libraries.
inputs - values – Values provided by the user.
accessible Accessible via PublicGroovyAPI:
api.global - access – Access to the data , which survive across multi-item calculations.
api.targetDate() - a date, – Date for which we perform the calculation. This date determines , which version of logic will be used, and has impact for on selection of table versions to be used - – e.g. 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 quote, quotes it contains an Effective Date - , i.e. the first date of validity of the quote.
api.product(“sku”) - id – ID of a product , which is currently being calculated. This is used only in certain executions, for example for pricelist item calculation, quote item calculation, etc.
api.currentItem() - in – In “item” logics, it’s it is commonly used to provide content of the object being calculated, but in some executions it’s it is also used to provide metadata information, and ; some other executions might not get the information at all.
api.isSyntaxCheck() - a flag, isInputGenerationExecution() (isSyntaxCheck before version 10.0) – Flag defining if the execution is of this special type Syntax Check“input generation”. Used only for some types of Logicslogics, commonly to provide information , that the logic is now expected to build input fields definitions.
api.isDebugMode() - a flag, – Flag defining if the execution is performed in a testing mode - – e.g. typically from Pricefx Studio. This information is commonly used to mock input values from the user , which are not available during Test the test mode, but would be available in a real execution.
api.getDatamartContext() - access – Access to an object , which allows to perform queries to Analytics tables.