View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0017198||Packages||LazReport||public||2010-08-18 16:39||2014-10-19 02:34|
|Reporter||razor7||Assigned To||Jesus Reyes|
|Status||resolved||Resolution||no change required|
|Product Version||0.9.29 (SVN)|
|Target Version||1.4||Fixed in Version||1.3 (SVN)|
|Summary||0017198: Can not calculate Accumulative Subtotals|
|Description||Hi, 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!
|Tags||No tags attached.|
|Fixed in Revision|
|Widgetset||GTK, GTK 2, Win32/Win64, QT|
Basically LazReport does not currently support running totals.
This feature is being implemented.
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.
||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?|
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.
RunningTotal_tests.zip (131,238 bytes)
Can be closed no change required?
||Yes, I think the presented solution should be enough.|
|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: RunningTotal_tests.zip|
|2012-06-17 00:20||John Kozikopoulos||Note Edited: 0060584|
||Note Added: 0078325|
||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|