Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

summing up a field based on condition in Purchase Order Report

Posted on by 8

Hi, so basically, I'm trying to sum up the Amount Including VAT field on purchase orders based on the type Charge Item for the particular PO No and then show it in my PO report.

After trying for a while, I got this working but found out there's another issue that caused the number of lines in my report to be reduced to 1 due to the code I inserted in the onaftergetrecord trigger of the report section. (screenshot below)

 
////
I should have three lines on my PO page, but the report preview shows only a single item line.
The chargeamountothers field, which is the calculation, is accurate, as I have two PO lines that aren't shown here as 5000 + 6000, which amounts to 11000.
 
////
This is my code right here in the onafter trigger. 
chargeamountother is a decimal variable.
 
What am I doing wrong here, and what are my options? I have tried creating a new variable record for purchaselines, using it, and trying the reset();
 
bc21. Any help would be appreciated, as I'm stuck with this issue.
Categories:

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans