Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

Help with Display method

Posted on by 1,021

Hello all ,im using ax 2012 R3

i need to create display method to get purchase agreement Qty and add this method on InventOnhandItem (Form)

i need qty depend on inventlocation dimension 

any help please

  • Martin Dráb Profile Picture
    Martin Dráb 228,588 Most Valuable Professional on at
    RE: Help with Display method

    Also notice that AgreementLine is a shared table, therefore you should filter it by DataAreaId.

  • source258147 Profile Picture
    source258147 1,021 on at
    RE: Help with Display method

    i need to add a purchase agreement qty on InventOnhandItem form depend on warehouse

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Help with Display method

    Be careful, the InventOnhandItem form is grouped in various ways depending on the dimension selection. You can't use fields that are not grouped on to select anything in your method (and I think InventDimId is not grouped)

  • Martin Dráb Profile Picture
    Martin Dráb 228,588 Most Valuable Professional on at
    RE: Help with Display method

    "Wrong" still can mean many different things and each of them would require a different solution, therefore it's absolutely crucial to know what exactly is wrong.

    By the way, now I noticed the reference to this; I overlooked it because I didn't expect it on the left side.

    Can you explain the business logic you're trying to implement by your code?

  • source258147 Profile Picture
    source258147 1,021 on at
    RE: Help with Display method

    "It's not working fine" i mean i get wrong qty

    i think the problem is  inventsum.inventdimid  not equal paQty.InventDimId

    for this reason i get 0 qty for items

    when i comment this code && this.InventDimId == paQty.InventDimId

    i get wrong qty

    how can i get relation between inventsum table and AgreementLineQuantityCommitment  or AgreementLine

    sorry for my english :)

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 228,588 Most Valuable Professional on at
    RE: Help with Display method

    "It's not working fine" it's not a very detailed description of your problem, therefore you can't expect detailed answers.

    Nevertheless I noticed that your method never refers to the current record ("this"), which is highly suspicious. It will always return quantity for the first item, not for the current item.

    You'll have to get used to debugging your code, because it would clearly show you this problem.

  • source258147 Profile Picture
    source258147 1,021 on at
    RE: Help with Display method

    im trying to learn 

    im write this code and it's not working fine with me

    i created method in inventsum table

    Display AgreementCommitedQuantity getPoQty()
    {
    AgreementLineQuantityCommitment paQty;
    AgreementLine agreementLine;
    InventDim inventDim;

    select ItemId,sum(CommitedQuantity)
    from paQty
    group by ItemId
    join inventDim
    group by inventDim.InventLocationId
    where inventDim.inventDimId == paQty.InventDimId

    && this.ItemId == paQty.ItemId
    && this.InventDimId == paQty.InventDimId

    return paQty.CommitedQuantity;
    }

  • Martin Dráb Profile Picture
    Martin Dráb 228,588 Most Valuable Professional on at
    RE: Help with Display method

    And what's the problem? Do you know how to write display methods and queries in general? If not, please look into documentation. If you do, please explain your particular issue.

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,554 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,588 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans