Banded Report Writer - Totals (Banded Report Writer)
At 01 JUN 2020 09:51:02PM rdhull50 wrote:
I have created a report in BRW and have created two totals in the PageFooter using the scripts Sum(VTimeCtl) and Sum(CTCtl). Where VTimeCtl is the control for the field Vtime which is a symbolic for EndTime - StartTime. CTCtl is the control for the field CT which is a symbolic which equates to @ans = 1.
When I put the calculated fields in the pagefooter of the report, at the end of the report (last page) I get the correct totals, but at the bottom of the first page, I get a "1" for Sum(CTCtl) and "1.73" for Sum(VTimeCtl). Those values are actually the amounts for the corresponding fields CT and VTIME for the first row on the top of the NEXT page.
The "RunningSum" property for these two Calculated fields on the report is "NoRunningSum"
For example, if I print a report with 52 records, the Grandtotal of CT should be 52 and the Grandtotal of VTime should be 98.86. This is correct for the grand-total at the bottom of the report, but as I said, the total for CT on the first page is "1" and the total for VTime is 1.73. These are the values for CT and Vtime for the first record on the following page.
If I set the "RunningSum" property to "SumOverAll", then I get a GrandTotal of 53 for CT and a GrandTotal of Vtime of 100.59. These values are inflated by "1" for CT and 1.73 for Vtime which appears on the bottom of the first page.
Please see the attached PDF
At 03 JUN 2020 08:48AM bshumsky wrote:
Have you tried putting these values in the ReportFooter, rather than PageFooter, section of the report?
- Bryan Shumsky
At 03 JUN 2020 08:42PM rdhull50 wrote:
I found that if I put it in the Group Footer with Keep Together - Whole Group for the Sorting and Grouping for that Group and the Footer Section checked, then it works.
For those that are multi-valued, I first create a symbolic that sums the fiield, i.e. sum({fieldname}) and put that calculated field in the Group Footer then it will also work for MV fields. Creating a VB Script that does a sum(Ctrl.Name) does not work on MV fields.
At 04 JUN 2020 09:01AM bshumsky wrote:
I found that if I put it in the Group Footer with Keep Together - Whole Group for the Sorting and Grouping for that Group and the Footer Section checked, then it works.
For those that are multi-valued, I first create a symbolic that sums the fiield, i.e. sum({fieldname}) and put that calculated field in the Group Footer then it will also work for MV fields. Creating a VB Script that does a sum(Ctrl.Name) does not work on MV fields.
Glad that you were able to get that to work.
As I've mentioned, it's not a surprise that the VBScript sum() won't work on MV fields because all data in MV fields is considered "string" data (not numeric) unless you "break out" the MV field data into its own "child table".
- Bryan Shumsky