Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How To Get "Line Discount" Value in PO > Totals screen for an SSRS Report?

Posted on by 878

Hello awesome community! :)

In PO > Totals screen

Here is a screenshot:

3554.Capture.PNG

I want to know how can I get the value of "Line Discount" field.

I tried to use the "PurchTotals" Class using this guide:

https://community.dynamics.com/ax/b/daxbeginners/archive/2014/08/19/how-to-use-aot-query-through-x

but I didn't find a method that will get me the value of "Line Discount" field.

There is a "lineDisc()" method in the class but it gets me different value than the one in the screenshot above.

Your help will be apreciated!

Thanks in advance!

*This post is locked for comments

  • Momochi Profile Picture
    Momochi 878 on at
    RE: How To Get "Line Discount" Value in PO > Totals screen for an SSRS Report?

    Sorry, forget what I said above.

    My mistake, the reason it was showing 38500 instead of 18750 is because there was a mistake in the design.

    Your code is correct.

    Thank you for your help Mr. Sohaib! :)

  • Momochi Profile Picture
    Momochi 878 on at
    RE: How To Get "Line Discount" Value in PO > Totals screen for an SSRS Report?

    Also I found a table called "PurchTotalsSummary"

    Which has most of the data of "Totals" screen.

    and I found it has a field called "LineDiscount" which has the correct data I need "18750".

    Is this table valid?

    Thanks!

  • Momochi Profile Picture
    Momochi 878 on at
    RE: How To Get "Line Discount" Value in PO > Totals screen for an SSRS Report?

    Hello Mr. Sohaib Thanks for your time and help!

    I tried what you mentioned but the the result it gave me was "37500" which I found is the double of what is shown in the screen "18750".

    I don't know why but is it safe to do:

    "    PurchTotals.purchLineDisc()/2;   "?

    Or is there a better way?

    Thank you!

  • Verified answer
    Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: How To Get "Line Discount" Value in PO > Totals screen for an SSRS Report?

    You may want to use object of PurchTotals Class

    PurchTable      PurchTable;
        PurchTotals     PurchTotals;
        ;
        PurchTable= PurchTable::find('000037');
        if(PurchTable)
        {
            PurchTotals = PurchTotals::newPurchTable(PurchTable,PurchUpdate::All);
            PurchTotals.calc();
            info(strFmt('%1',PurchTotals.purchLineDisc()));
        }
        else
        {
            info('Invalid PO number');
        }

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans