Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to retrieve item's average cost price?

(1) ShareShare
ReportReport
Posted on by 1,085

Hi,

I need to get the COST PRICE it is showing in OH HAND screen for an item.

I need to join InventDim table and InventSum table, to get specific Inventory Dimensions for that item.

 

I noticed an 'averagecostPriceUnit' method in InventSum table, but i don't know how to use it

inside a query.

 

My starting query is something like:

 

select * from inventSum join inventDim where inventSum.inventDimId == invendDim.inventDimId

&& inventSum.itemId == _myItemId

&& inventDim.inventLocationId == _myInventLocationId

&& inventDim.inventSiteId == _myInventSiteId;

 

How do i retrieve the averageCostPrice for my item?

 

Thank you in advance

regards 

*This post is locked for comments

  • Zain Bokhari Profile Picture
    Zain Bokhari 3,208 on at
    RE: How to retrieve item's average cost price?

    Hi Smit, please verify and close the question you posted for this requirement as well. Thanks.

  • RE: How to retrieve item's average cost price?

    Hi Osama,

    Code worked for me. As I wanted details on site basis I have added some additional code and pushed all records in temp table.

    Thanks a lot!!

    Regards,

    Smit Patel

  • RE: How to retrieve item's average cost price?

    Hey hi,

    Did anyone find solution? I want same code :)

    Anyways my requirement is to get all records in temporary table and I am trying to achieve by below code but problem is logic in InventSum_AverageCostPriceUnit method is complex. I tried to copy same logic but not able to get any results.

    If Item has 6 transactions then InventSum table is displaying many values don't know how.

    I will try Omer's code but he is taking lit of parameters. Anyways thanks :) Win32 seems move to different ERP..:D

    Regards,

    Smit

  • Suggested answer
    RE: How to retrieve item's average cost price?

    // try this, hope it helps

    static void SL_FindItemCostPriceAsPerDate(Args _args)

    {

       InventDim           inventDimCriteria;

       ItemId                 itemId;

       InventDimParm  inventDimParm;

       date                    perDate = mkDate(28,3,2016);

       InventOnHand    inventOnHand;

       ;

       itemId                 = '010100002';

       inventDimCriteria.inventBatchId = '123456';

       inventDimParm.initFromInventDim(inventDimCriteria);

       inventOnHand    = InventOnhand::newParameters(itemId, inventDimCriteria, inventDimParm);

       info(strfmt('%1', inventOnHand.costPricePcs(false, perDate)));

    }

  • RE: [AX2012] How to retrieve item's average cost price?

    Please post a full working job example.

    Thanks

  • Nadeem Bhatti Profile Picture
    Nadeem Bhatti 2,055 on at
    RE: [AX2012] How to retrieve item's average cost price?

    Hi vv1984,

    I need this job, can you please post for me.

    Thanks

  • Pradeep Itnal Profile Picture
    Pradeep Itnal 3,248 on at
    RE: [AX2012] How to retrieve item's average cost price?

    Take a look at inventSum table, i guess there is a method.

  • Nadeem Bhatti Profile Picture
    Nadeem Bhatti 2,055 on at
    RE: [AX2012] How to retrieve item's average cost price?

    I also need the avg price of item on given date, if some can provide me.

  • RE: [AX2012] How to retrieve item's average cost price?

    Can anyone please mail me a working job?

  • waseem osman Profile Picture
    waseem osman 40 on at
    RE: [AX2012] How to retrieve item's average cost price?

    Dear VV,

    Please mail me full working job.

    Thank you,

    Regards

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans