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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

How to add current and previous field record on a form datasource and display it using display method

(0) ShareShare
ReportReport
Posted on by 120

AX-_2D00_-Copy.png

add the first Quantity value to previous data and display it using display method 

I have the same question (0)
  • Bala Chandra Profile Picture
    355 on at

    Hi Jesen,

    You can use tmpFrmVirtualLines table and write the logic to push the previous qty to this table. From this table data can be shown using display method.

    You can refer to standard code \Forms\PurchLineCopy\Data Sources\VendInvoiceTrans\Methods\copy

  • Sergei Minozhenko Profile Picture
    23,095 on at

    Hi Jeson,

    What kind of requirements do you have? You can sort or filter data on the form in different ways and the results of this field will be unpredictable.

  • HenryXie Profile Picture
    Microsoft Employee on at

    Hi Jeson,

    You can place your display method in a table, form data source or directly on a form (similarly with reports).

    I will be demonstrating the usage of display methods by a quick example.

    1, add a display method on a form datasource

        the method looks:

    public display Qty DisplayQty(InventTrans _inventTrans)
    {
        return _inventTrans.qty;
    }

    2, Add this display method to a form grid control. drag this display method drop to grid. there will be create new field control.

    change the [datasource] = InventTrans and the [Data method] = DisplayQty properties of the grid new field control.

    It's better to write Display methods on the table level so that the same method can be used on multiple forms and reports where the table is used as a Datasource.
    If the value returned is to be shown in a grid then the Display method must be written on the form datasource level as shown in our example above.


    Find details in https://docs.microsoft.com/en-us/dynamicsax-2012/developer/using-the-display-method-modifier?redirectedfrom=MSDN

  • Jeson Profile Picture
    120 on at

    Thank you Bala Chandra. I will try it... sorry for asking you this. im a newbe in ax. speaking of Temporary table im just wondering when its value or data will be deleted?

  • Jeson Profile Picture
    120 on at

    Hello Sergei Minozhenko! my requirements is to add another display method that add previous qty value  and the next qty value on a grid.. my problem i don't know how to get the previous value.

  • Jeson Profile Picture
    120 on at

    Thank you Henry Xie.. my requirement is to add the current qty and the previous qty and display the sum beside the current qty and on the next line i want to get the previous sum qty the add it to the next line current qty. but i don't how to get the previous record on form datasource.

    example:

    Qty   Sumqty

    1           1

    2           3       (prev Sumqty + current qty)

    5           8       (prev Sumqty + current qty)

    -5         3        (prev Sumqty + current qty)

  • Martin Dráb Profile Picture
    239,118 Most Valuable Professional on at

    You're new to AX and insist on doing it. I work in AX for years and I don't think it's a good idea. Also, think about whether you commonly see such design in the standard application and whether it doesn't have a reason. aybe you should think again about if it's the best approach.

    If you want running totals, I suggest you build a report.

    If you want to use a form anyway, can you please address Sergei's remark? You shouldn't write any code before deciding how the form should behave.

  • HenryXie Profile Picture
    Microsoft Employee on at

    Hi Jason, sorry previously I misunderstood your requirement. if you want to show cumulated qty on form grid control, normally use report will be better.

  • Jeson Profile Picture
    120 on at

    Thank you for the advice Martin. My requirement exist in Master planning/Common/Planned/View/Requirement profile in Accumulated column but when i trace it its really really hard to understand haha maybe its not time yet but i will not give up on this one. Thank you.

  • Jeson Profile Picture
    120 on at

    Hello Henry, its ok. Ill just try to convince my client to display it on a report Thank you.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 689

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 258 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans