How to get the Inventory cost using AX methods

Hello everyone,

Inventory cost might be a tricky problem for us,

can anyone provide some guide about how to pick up Standard MS methods when we want to generate the item’s cost?
Say, the inventory is re-calculated every night, then what is the desired method to pick up when I am asked to give the cost for a specific item?

-1- I found “InventTable.costPcsPrice()” is used a lot, but is it always good method to dig out the cost number?

public server display CostPrice costPcsPrice(
InventDimId _inventDimId = ‘’,
InventDim _inventDim = null,
InventTableModule _inventTableModuleInvent = null,
PriceDate _priceDate = systemDateGet(),
boolean _throwError = false)

The minute I see these “cacheKey” / “cacheValue” I am really not that certain.

-2- I noticed there is a field [SalesLine].[CostPrice], but it seems it’s written at certain time point, I checked cross-ref, there are so many of places! And it’s not the average cost.

-3- Anyway, I noticed the InventDimId is always checked when doing the average cost, can I get some help about why this is the case?

Thank you,