Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Summing total qty field for all rows for a column on list page

Posted on by 65

Screenshot-2022_2D00_10_2D00_07-003234.png

This is on a custom page, for a custom table. The above code is not summing every row in the table, just the row that is selected. This code is the way I envision calculating the sum for a field (outstanding qty), and displaying it in the total qty field. Again, it is just calculating the individual line that is selected though, and displaying that value in the total qty field, instead of summing up every row and calculating the outstanding qty for the entire table. 

Any ideas on this would be appreciated. If you do comment, please be specific in your suggestion. 

Thanks. 

  • Verified answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: Summing total qty field for all rows for a column on list page

    Thank you for sharing final solution.

  • Verified answer
    AGV Profile Picture
    AGV 65 on at
    RE: Summing total qty field for all rows for a column on list page

    Correction, I switched the "Total Qty" field to a variable on the page when trying to resolve before switching the calculation to := KPSAL."Outstanding Quantity", which seemed to be the issue. Below code is correct:

     Screenshot-2022_2D00_10_2D00_07-045106.png

  • AGV Profile Picture
    AGV 65 on at
    RE: Summing total qty field for all rows for a column on list page

    Hey Danele, I tried that right after this post, and it still did not work. However, that syntax works with other tables/pages because I have done it successful on the sales line page.

    I think it is the way the custom table/page is pulling in the values. I did not create the table/page, but it should work the way you described because I have successfully done that on other pages already.

    I'll just have to use the calcsums procedure on the sales line page because it is summing up the values in the entire column just fine using that table.

    Thanks.

  • Suggested answer
    azharsaeedkhan Profile Picture
    azharsaeedkhan 60 on at
    RE: Summing total qty field for all rows for a column on list page

    Try

    Rec."Total Qty" := KPSAL."Outstanding Quantity";

  • Suggested answer
    DAnny3211 Profile Picture
    DAnny3211 9,272 Super User 2024 Season 1 on at
    RE: Summing total qty field for all rows for a column on list page

    Hello

    excuse me but is KPSAL the same table as the Rec of the page?

    once you calculate CalcSums with the KPSAL variable you should assign it to the rec. "total Qty."

    rec. "total Qty.":=KPSAL. "Outstanding Quantity"

    I don't know if I'm missing something or you can add some more details.

    another idea might be to create a flowfield of type Sum with the filter logic you apply in your procedure

    DAniele

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

Featured topics

Product updates

Dynamics 365 release plans