Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

How to retrieve item's average cost price?

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 

  • 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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    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
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    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)));

    }

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans