Eddie Monster
8th March 2002, 18:38
I have a report written by one of the consultants that aided us in our implementation. The consultant used the Total Aggreagate Function to get the total for a grouping. For Example (report layouts)...

Detail Record 1: variable amnt.copr = 100.00
Detail Record 1: variable amnt.copr = 230.00
Detail Record 1: variable amnt.copr = 900.00

After.grouping: variable amnt.corp = 1123.00

The same report field variable is used in the detail section and the after.grouping section of the report, but because the after.grouping report field has the aggregate function set to 'Total', the total is printing. I understand the functionality.

However, I am now trying to use a db.insert command to populate a new table with the grouping totals for this report (to be used with another session). When I run the report, the report prints as it always has, and I get data in my table where I want to, but instead of getting the value 1123 for amnt.copr I get 900. Is there any way to get the total aggregate value of amnt.copr?

mark_h
8th March 2002, 19:33
Hello Eric!

You can run the report in debug mode and see which of the total fields has the value you are looking for - by this I mean the total..1,total..2 fields. Each field that you do a total on gets a variable like this. Just remember that if you use this type of variable and you change the report, then the total..x variable may change. I do not recommend this and I even use it in some cases.

The way I would do this, is in the report script create a new variable. Then in the detail event(after layout) I would add the value to the new variable. Then use this to update the table - much cleaner and easier to update.

Mark

Quick example

declaration:
extern double x

before.program:
x=0

detail.1:
after.layout:
x = x + amnt.copr