/
Historical Data

Historical Data

This utility calculates historical data in a price list for each line.

The included data:

  • Weighted averages of a List Price per unit

  • Margin per unit

  • Cost per unit

  • Margin %

  • Total value of volume for last X months

 The calculated data is cached using api.global, so you need to set api.retainGlobal = true in your calculation logic. 

Usage

This code checks if the data is cached or not using 'isCachedHistoricalData()'. 

def lib = libs.PriceListManagement.HistoricalPrice if(!lib.isCachedHistoricalData()){ //calculate }



This code calculates the historical data.

api.retainGlobal = true def lib = libs.PriceListManagement.HistoricalPrice lib.calculateHistoriCalData(12) // calculate historical data for last 12 months



This code gets the historical data for a specific SKU.

def lib = libs.PriceListManagement.HistoricalPrice return lib.getHistoricalData(api.product("sku"))



In addition, you can get a specific piece of data for a product.



Settings are read from the application advanced properties, however you can overwrite it and calculate data manually.



Related content

Cost Plus Strategy
Cost Plus Strategy
More like this
Get Cost And Margin
Get Cost And Margin
More like this
Price List Header Logics
Price List Header Logics
More like this