web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to calculate and display a new field on a grid?

(0) ShareShare
ReportReport
Posted on by

I'm new to AX development.  I have created a grid control with a few fields.  One field is named Qty and another field is named ScrapQty.  I now want to add another field named Remainder.  Remainder = Qty - ScrapQty.  But I can't figure out how to do this.  Can anyone help?

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: How to calculate and display a new field on a grid?

    Hi Robert,

    You would use a display method on the table which is linked to your grid.

    (search for 'display' on the AOT tables node to have a reference.

    In this method you'll have 1 line:

    return this.Qty - this.ScrapQty

    Go back to your form with the grid, add a new control of the Type Real, specify the datasource and don't specify a field, but use the method property to insert the name of your display method.

    You should have a calculated field by now.

  • Suggested answer
    PA-22040759-0 Profile Picture
    on at
    RE: How to calculate and display a new field on a grid?

    Here a link to MSDN where these "Display" fields are explained: msdn.microsoft.com/.../aa595058.aspx

  • Robert Herrmann Profile Picture
    on at
    RE: How to calculate and display a new field on a grid?

    Ok, thanks for the help.  But I get a syntax error when I try this.  Here is my code:

    display UnRecoveredScrap GetUnrecoverableScrap(wfsProdJournalRoute prodJournalRoute)

    {

         real UnRecoveredScrap = this.QtyGood - this.NGK_RecoverableScrapQty;

        Return UnRecoveredScrap;

    }

    The first line is underlined in red so I assume the syntax error is here.  What am I doing wrong?

  • Verified answer
    kmckelvey3 Profile Picture
    on at
    RE: How to calculate and display a new field on a grid?

    I believe your method heading should be:

    display real GetUnrecoverableScrap(wfsProdJournalRoute prodJournalRoute)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans