Logic Calculation Context

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 data which survive across multi-item calculations.

    • api.targetDate() – Date for which we perform the calculation. This date determines which version of logic will be used, and has impact 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 quotes it contains an Effective Date, i.e. the first date of validity of the quote.

    • api.product(“sku”) – ID of a product which is currently calculated. This is used only in certain executions, for example for pricelist item calculation, quote item calculation, etc.

    • api.currentItem() – In “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.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 – e.g. typically 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.

    • api.getDatamartContext() – Access to an object which allows to perform queries to Analytics tables.

Found an issue in documentation? Write to us.