I don't find the Reports demo or project under any of my 4Js installation directories. Can I access this code online, or can you attach the 4gl and 4rp files that show this?
The Report demo project can be found either My Documents/My Genero Files/sample/reports/Reports.4pw, or GSTDIR/samples/reports/Reports.4pw.
The first time you started Genero Studio it would've been a link in the Welcome Page but will have dropped off the bottom of the list no doubt. In my training courses, the first exercise is to become familiar with the demo reports.
I am going to contradict something Romain said. Leave your AFTER GROUP and GROUP SUM in your 4gl code. Just make sure you have the REPORT defined as ORDER EXTERNAL. Basically use the strengths of the database to sort your database, have the runner sum your totals for you as it goes. You shouldn't need to manually keep a running total like the demos do. In the attached example you will see ...
ORDER EXTERNAL BY x.group, x.code
FORMAT
BEFORE GROUP OF x.group
PRINTX x.group
ON EVERY ROW
PRINTX x.*
AFTER GROUP OF x.group
LET grp_sum.sales = GROUP SUM(x.sales)
LET grp_sum.costs = GROUP SUM(x.costs)
LET grp_sum.count = GROUP COUNT(*)
PRINTX grp_sum.*
... you can use these values in the AFTER GROUP in the report after the corresponding group detail has been processed. It is a bit hard to explain but note in the attached report the Group Sum Row is after the Group Code trigger.
Now there was an error in Studio Bz 12567 that meant these values in the AFTER GROUP couldn’t be selected in the expression editor code completion, and appeared in the Document Errors. With the attached report you should note that it runs fine and hopefully this bug will be fixed in the next version.