...
Define the matrix key generator (matrix pricing logic):
- Go to Configuration > Calculation Logic > Generic Logic. Create a new logic and set Nature to Matrix.
- Define the logic's elements. Create one visible element which will return a list of keys generated based on input parameters. Below is an example of keys generated from Datacenters, Terms_Payments, Tiers, Customers, and Programs elements.
...
Define a price list logic which will reference the matrix logic and retrieve the key list:
- Go to Configuration > Calculation Logic > Generic Logic. Create a new logic.
- Create an element which retrieves the secondary key using the method
api.getSecondaryKey()
. The returned key can be split into various components which will be used to calculate the price based on their variations.
Code Block language groovy def key = api.getElement("Debug")=="No" ? api.getSecondaryKey() : "B1A-36PT5-C1S" def parts = key?.tokenize("-") return [ dc: parts[0], term: parts[1][0..1], payment: parts[1][2], tier: parts[1][3..4], program: parts[2][0], version: parts[2][1], priceType: parts[2][2] ]
This makes it possible to extract a secondary key component for subsequent substitutions. Like this:
Code Block language groovy return api.getElement("SecondaryKey")?.dc //for Datacenter
or
Code Block language groovy return api.getElement("SecondaryKey")?.term //for Term
- Subsequent logic performs substitutions to build the SKU, look up currency, and calculate prices for the price list.