Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Before a Logic is executed, the system will always collect a set of important information needed for the execution of the logic - referred 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 variables provided to the Logic

    • api - provides access to the instance of PublicGroovyAPI, to be able to perform many operations within Pricefx engine

    • out - access to result 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 the data, which survive across multi-item calculations.

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

    • api.product(“sku”) - 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 “item” logics, it’s commonly used to provide content of the object being calculated, but in some executions it’s also used to provide metadata information, and some other executions might not get the information at all.

    • api.isSyntaxCheck() - a flag, if the execution is of this special type Syntax Check. Used only for some types of Logics, commonly to provide information, that the logic is now expected to build input fields definitions.

    • api.isDebugMode() - a flag, if the execution is performed in a testing mode - e.g. typically from Studio. This information is commonly used to mock input values from user, which are not available during Test mode, but would be available in real execution.

    • api.getDatamartContext() - access to an object, which allows to perform queries to Analytics tables

  • No labels