Page 1 of 1

Aggregating data

Posted: Wed Mar 05, 2008 12:00 pm
by sri75
HI,

I have source data like this

Code: Select all

Ubox empno week  fri      sat      sun    mon      tue      wed      thu
 
134   111       1      2        3      3       0         0       0         0
134   111       2      1        2      1       1         2       3         4  
134   222       1      1        2      5       1         4        5        6
134   222       2      4        3      4       5         6        7        8    
I want the out pu tlike this

Code: Select all

Ubox empno week  fri    sat      sun    mon      tue      wed      thu  total  gt
 
134   111       1      2        3      3       0         0       0         0         8
134   111       2      1        2      1       1         2       3         4        14      22
134   222       1      1        2      5       1         4        5        6        24
134   222       2      4        3      4       5         6        7        8         37     51

for each employee hours of week1 (8 hrs) and also hours of week 2 (14 hrs) and total hours 22 and also hours of all employees of week1and week2 on each day



Can you please tell me how to do this with aggregator stage or any other logic

Thanks
Sri

Posted: Wed Mar 05, 2008 12:14 pm
by kcbland
You'll want to order your data, as you need running totals. Stage variables seem to be the best way to do things.

Posted: Wed Mar 05, 2008 12:19 pm
by sri75
HI Kenneth,

Thanks for your reply. I don't need running total, i need total hours of week1 and week2 for particulat employee and total hours of all employees in week1 as well as week2


Thanks
Sri

Posted: Wed Mar 05, 2008 3:14 pm
by ray.wurlod
Stage variables are still a good way to collect running totals from sorted data. When it's the second week number, append a line terminator and the total to the final column and write to a sequential file, then read from that sequential file to get the desired result. Put the grand total in the user status area and use an after-stage subroutine to append that to the file.

Posted: Thu Mar 06, 2008 8:19 am
by sri75
Thanks Ray for your suggestions.I will try it