spatters
19th December 2005, 16:48
Is it possible to print the totals of each group at the end of the report?
I've attached an example report as it currently is. I'd like to see totals at the end for each Resp code used.
For example:
Total Resp 1 111.00
Total Resp 2 222.00
Total Resp 5 555.00
I know this should happen in the after.report section, but, how do you get it to print? The Resp column is an enumerated type.
en@frrom
19th December 2005, 17:30
I don't know what the resp represent in your case. I don't know if there are a fixed amount of resp's or not. But even if not, you can build a loop system querying the data, starting to check the total of resp 1, sending to spooler, force a new line, and then total of resp2, and to spooler, force new line etc... This is not the standard Baan way, and depending on your type of query it could also be a serious performance escalation, but it will work...
If you give more details, maybe we can give you mores pecific advice...
spatters
19th December 2005, 17:37
Assume the resp (responsibility code) will be variable.
I can accumulate totals while the report is running, so, getting the data is not the problem.
The problem I have is I don't know how to get it to go to the spooler to print on the report. I thought about creating a line in the report layout with just the resp field and total, but, I didn't know how to loop so it prints more than once with different values. How do I go about getting it to actually print on the report?
en@frrom
19th December 2005, 17:41
If I understand well, you want it to be an after.report layout. For looping, just use function layout.again, as many times as necessary, like this you will get total lines of each resp.
mr_suleyman
19th December 2005, 17:42
You should write small program to show totals of each resp . İf resp has many possible value , you should minimize your aim or improve your small program . if it has 3-5 diffrent value, use parameter for each resp. If has maximum 20 or 30 different value
you can use array functionality. Other I think it is impossible. Baan hasn't got total function that you wanne do. There is no group by function for finding each resp total.
Good luck !!!
mr_suleyman
19th December 2005, 17:47
Himm your problem is different.! En.fromm said right solution for your case. !!!
Good luck !
spatters
19th December 2005, 21:49
Thanks guys...I got it to work. I forgot you can define more than one after.report section. Also, the layout.again() function was exactly what I needed. Here are the results.
|******************************************************************************
|* aracpo41511000 VRC B40C c4 prod
|* Estimated Not Approved
|* slp1test
|* 12-14-05 [16:18]
|******************************************************************************
|****************************** declaration section ***************************
declaration:
extern domain tcsrnb resp.curr | current responsibility code
extern domain tfgld.amnt resp.total | RESPonsibility total
|****************************** report section ********************************
before.program:
resp.curr = 2147483647 | MAX long
detail.1:
after.layout:
| Is this the least responsibility code
if aracp013.resp < resp.curr then
resp.curr = aracp013.resp
endif
after.report.2:
before.layout:
| Populate the responsibility code and total
select sum(aracp013.esfr):resp.total
from aracp013
where aracp013.appr = tcyesno.no
and aracp013.resp = :resp.curr
selectdo
aracp013.resp = resp.curr
endselect
after.layout:
| Are there more responsibility codes
select aracp013.resp:resp.curr
from aracp013
where aracp013.appr = tcyesno.no
and aracp013.resp <> 5
and aracp013.resp > :resp.curr
order by aracp013.resp
as set with 1 rows
selectdo
layout.again()
endselect