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

Announcements

News and Announcements icon
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 790

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

I have the same question (0)
  • Community Member Profile Picture
    on at

    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
    6,194 on at

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

  • Robert Herrmann Profile Picture
    790 on at

    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
    195 on at

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans