/
Sample Logic
Sample Logic
Our logic will be a price list logic. We consider running it through a big number of product, therefore we will later focus on the performance.
The logic will calculate a price as a product cost plus a margin based on the product group, adjusted by a country factor.
It will also display a difference between the product cost compared to an average cost of all the products within the same product group.
The logic is purely artificial and serves only the purpose of this tutorial. It has little to no business value.
The logic has the following elements:
Element | Description |
---|---|
Country | Renders the Country user input which it populates with the available countries from the CountryFactor PP. |
ProductCost | Fetches the most recent product cost from the Product_Costs PX whose Valid From <= target date. |
ProductGroupAverageCost | Fetches the costs (regardless of the Valid From) of all products of the same product group as the product being calculated and calculates the average. |
AverageCostDiffPct | Calculates (ProductCost - ProductGroupAverageCost) / ProductGroupAverageCost. |
MarginAdjustment | Fetches the margin adjustment for the product group from the MarginAdj PP. |
BasePrice | Applies the MarginAdjustment to the ProductCost as ProductCost * (1 + marginAdj). |
CountryAdjustedPrice | Fetches the country factor from the CountryFactor PP based on the product group and the Country selected by the user and applies it to the BasePrice as BasePrice * CountryFactor. |
, multiple selections available,
Related content
Refactoring Based on Best Practices
Refactoring Based on Best Practices
Read with this
Used Data Structures
Used Data Structures
More like this
Calling Library Functions with Aliases
Calling Library Functions with Aliases
Read with this
Second Iteration – Structure and Performance
Second Iteration – Structure and Performance
More like this
Put "def" Outside of Loops
Put "def" Outside of Loops
Read with this
DM01: Efficient and optimized List Price (re)calculation based on pricing strategies
DM01: Efficient and optimized List Price (re)calculation based on pricing strategies
More like this
Found an issue in documentation? Write to us.