Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

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

Posted on by 120

AX-_2D00_-Copy.png

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

  • Jeson Profile Picture
    Jeson 120 on at
    RE: How to add current and previous field record on a form datasource and display it using display method

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

  • Jeson Profile Picture
    Jeson 120 on at
    RE: How to add current and previous field record on a form datasource and display it using display method

    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.

  • HenryXie Profile Picture
    HenryXie on at
    RE: How to add current and previous field record on a form datasource and display it using display method

    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.

  • Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: How to add current and previous field record on a form datasource and display it using display method

    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.

  • Jeson Profile Picture
    Jeson 120 on at
    RE: How to add current and previous field record on a form datasource and display it using display method

    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)

  • Jeson Profile Picture
    Jeson 120 on at
    RE: How to add current and previous field record on a form datasource and display it using display method

    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
    Jeson 120 on at
    RE: How to add current and previous field record on a form datasource and display it using display method

    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?

  • HenryXie Profile Picture
    HenryXie on at
    RE: How to add current and previous field record on a form datasource and display it using display method

    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

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: How to add current and previous field record on a form datasource and display it using display method

    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.

  • Bala Chandra Profile Picture
    Bala Chandra 355 on at
    RE: How to add current and previous field record on a form datasource and display it using display method

    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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans