Add New Calculation Logic

To create a new calculation logic (which is applied at the line item level):

  1. Go to Administration > Logics and select the required logic type.

  2. Click the Add Logic button.

  3. Enter a Name and a Label (optional).

  4. Enter a Nature of the calculation logic (applies only to generic logics):

    • Inline Details View – Defines the inline details for product/customer master or product/customer extensions.

    • Customer Input Filter – Determines which customers are available for the user to select.

    • Seller Input Filter – Determines which sellers are available for the user to select.

    • Quote Entitlement Filter – Determines which Quotes the user will be able to see and edit. See the details below.

    • Agreement & Promotion Entitlement Filter – Determines which Agreements/Promotions the user will be able to see and edit. See the details below.

    • Rebate Agreement Entitlement Filter – Determines which Rebate Agreements the user will be able to see and edit. See the details below.

    • Compensation Plan Entitlement Filter – Determines which Compensation Plans the user will be able to see and edit. See the details below.

    • Matrix – The logic is used for matrix Price Lists (Price Lists with two keys).

    • Creation Workflow – Allows more users to cooperate on document creation.

    • Workflow Delegation User Filter – Determines to which users the user is able to delegate their approval rights.

    • Product Input Filter – Defines a custom filter for the Product and Product Group pickers which are used throughout the application. Specifically for Quoting, there is another option to set up a product filter; see Quote Product Filter Logics.

    • Parametrized Calculation Flow – Defines a custom action for Price Lists / LPGs that will be available for users in the Mass Actions drop-down list.

    • Calculation Grid – Defines Calculation Grid columns and calculates their values.

    • Calculation Grid Keys – Defines the keys for Calculation Grids. The maximum number of keys is six.

  5. Optionally, select a Parent Logic. All elements of the parent logic will be copied to this new logic and will remain synchronized unless you modify them. Available only for generic and Sales Compensation logics.

  6. Enter a Valid After date. The validity date can be entered manually or via the date picker.
    Multiple calculation logics can have the same name but different validity dates. For price calculations the logic will be selected based on the Valid After date relative to the Target Date.

  7. Select a Status from the drop-down list:

    • Active – The calculation logic will be used in the price calculation. When more than one logic with the same name has the status Active, the logic that is valid on the selected Target Date will be used (see above).

    • Inactive – Default for a new calculation logic. The logic will not be used in price calculations.

    • Simulation Only – The calculation logic will only be used in simulations.

  8. Logics with status Simulation Only can have a name for the Simulation Set assigned (optional). If this is the case, this logic will only be used for the specified simulation.

  9. You can allow only user belonging to some user groups to view or edit this logic.

  10. Click Add. Then click the name of the new logic to configure the calculation logic.

 In order to be able to calculate a price, each product must be linked to a calculation logic (defined in the product master). A default logic can be chosen from the drop-down menu Select pricing method.

Details on Entitlement Filter Logics

Logics of the 'Entitlement Filter' nature are intended to assess which Quotes, Agreements/Promotions, Rebate Agreements or Compensation Plans the user will be able to see in detail and edit.

Requirements for the logic:

  • Its Nature must be set to Quote Entitlement Filter or Agreement & Promotion Entitlement Filter or Rebate Agreement Entitlement Filter or Compensation Plan Entitlement Filter.

  • It needs to be set as Active.

  • It needs to have one or more elements where each one returns a Boolean value (a result or a decision).

  • Only when all elements return true, the user is allowed to view/edit details of the document. (General Admin users will always be allowed to view all documents.)

  • To satisfy all these requirements, you can read data from the underlying Quote, Agreement/Promotion, Rebate Agreement or Compensation Plan and from any API call (e.g., api.user() to get the current user). It is then expected that a Boolean check will be the result of the decisive logic element.

  • In the Quote logic, a Quote for which the check happens is available as a Quote variable (similarly as in the workflow logic).

    For example, there might be just a single element:

    quote.additionalInfo4 == "blue"

    which will allow only Quotes with additionalInfo4 == "blue" to be opened.

  • For any check depending on other data stored elsewhere, you should always keep in mind that it is desirable to avoid any complex logic/fetches from the database. Ideally, you should never need more that a single api.find call to check if some data that grants a user the access to Quote details or not.

    The following example

    def result = api.find("CX30", 0, 1, null, Filter.and(Filter.equal("name","myCXTable"), Filter.equal("attribute1", contract.inputs[0].value))) return result != null && !result.isEmpty()

    will try to find up to 1 record which respects the filter. Projects with high data volumes and on dedicated instances should check whether they might need indexes on the fields used for filtering.

Which Logic will be Used for Calculation?

There can be many pricing logics defined and they can be associated with:

  1. Specific product (on the Product page),

  2. Object (Price List, etc.),

  3. and then there is the general Default logic.

For calculations, the system will always use the first applicable logic (in the order given above). If a header logic is defined, an order of execution applies.

Found an issue in documentation? Write to us.

 
Pricefx version 12.0