View Issue Details

IDProjectCategoryView StatusLast Update
0017198PackagesLazReportpublic2014-10-19 02:34
Reporterrazor7 Assigned ToJesus Reyes  
Status resolvedResolutionno change required 
Product Version0.9.29 (SVN) 
Target Version1.4Fixed in Version1.3 (SVN) 
Summary0017198: Can not calculate Accumulative Subtotals
DescriptionHi, Im working with LazReport and I can't find the way to calculate accumulative subtotal per page.

Ie: If subtotal sum of each page is $100, I need to show $100 subtotal for first page, $200 for second page and $300 for last page.

Any idea on how to achieve this?

If it is not possible, please add some mechanism to achieve this.

Thanks in advise!
TagsNo tags attached.
Fixed in Revision
WidgetsetGTK, GTK 2, Win32/Win64, QT
Attached Files


Jesus Reyes

2010-09-12 04:28

developer   ~0040981

Basically LazReport does not currently support running totals.

This feature is being implemented.

John Kozikopoulos

2012-06-15 18:14

reporter   ~0060557

Last edited: 2012-06-16 00:34

01 ) make sure you have a report with a master data band connected to a dataset
02 ) place a text inside that band and double click to open its editor.
03 ) on the editor check the script option on the top left.
04 ) on the script window paste the following code.

IF [Line#] = 1 then RunTotal := [Dbf1."MTH_NO"]
else RunTotal := RunTotal +[Dbf1."MTH_NO"];

of-course you need to replace [dbf1."MTH_NO"] with your field, the one you want a running total.

05 ) Press OK to save the changes.
06 ) reopen the editor by double clicking on the text object
07 ) press the "Variable" button.
08 ) select the fr variables category on the drop down combo.
09 ) double click the RunTotal variable to be place on Memo.
10 ) press OK and then press Preview.

You should now have a running total in your band.

Jesus Reyes

2012-06-16 08:40

developer   ~0060575

I think this is a simple solution to a not so frequent use case. Provided that it works (sorry no tested but I think it should work), I think is simple enough, that maybe a RunningSum or PartialSum aggregate function is not necessary, what you think?

John Kozikopoulos

2012-06-16 19:37

reporter   ~0060584

Last edited: 2012-06-17 00:20

I think thats a solution that needs to be documented and let the end users decide if it is enough or not. The main goal should be a better documentation at this point and not extending the existing components.

I have attached a small project to show the results of the method its a simple project with one form and 2 reports on it with SaveInDFM = true;
the 1st report uses the TDBF component and the tables in <LazarusInstallDir>\examples\database\dblookup\data\ and the second one requires a Firebird installation and the database from <FirebirdInstallationDir>\examples\empbuild\EMPLOYEE.FDB.

The project is not written to be executed there are problems when running which seem to be lazreport specific. you should just doubleclick the reports and press preview to see the results.

2012-06-17 00:15 (131,238 bytes)

Reinier Olislagers

2014-10-18 05:43

developer   ~0078325

Documented at
Can be closed no change required?

Jesus Reyes

2014-10-19 02:34

developer   ~0078360

Yes, I think the presented solution should be enough.

Issue History

Date Modified Username Field Change
2010-08-18 16:39 razor7 New Issue
2010-08-18 16:39 razor7 Widgetset => GTK, GTK 2, Win32/Win64, QT
2010-08-21 19:33 Jesus Reyes Status new => assigned
2010-08-21 19:33 Jesus Reyes Assigned To => Jesus Reyes
2010-09-12 04:28 Jesus Reyes Note Added: 0040981
2012-06-15 18:14 John Kozikopoulos Note Added: 0060557
2012-06-16 00:34 John Kozikopoulos Note Edited: 0060557
2012-06-16 08:40 Jesus Reyes Note Added: 0060575
2012-06-16 08:42 Jesus Reyes LazTarget => -
2012-06-16 08:42 Jesus Reyes Status assigned => feedback
2012-06-16 19:37 John Kozikopoulos Note Added: 0060584
2012-06-17 00:14 John Kozikopoulos Note Edited: 0060584
2012-06-17 00:15 John Kozikopoulos File Added:
2012-06-17 00:20 John Kozikopoulos Note Edited: 0060584
2014-10-18 05:43 Reinier Olislagers Note Added: 0078325
2014-10-18 05:43 Reinier Olislagers Status feedback => assigned
2014-10-19 02:34 Jesus Reyes LazTarget - => 1.4
2014-10-19 02:34 Jesus Reyes Note Added: 0078360
2014-10-19 02:34 Jesus Reyes Status assigned => resolved
2014-10-19 02:34 Jesus Reyes Fixed in Version => 1.3 (SVN)
2014-10-19 02:34 Jesus Reyes Resolution open => fixed
2014-10-19 02:34 Jesus Reyes Target Version => 1.4
2014-10-19 02:34 Jesus Reyes Resolution fixed => no change required