Re: Structure of ACE report for totalling
Posted in 1997
How about this....
database <dbname>
end
select 'ian ' employee_name, 100 employee_amount, 'D' status, 'X' dept
from systables where tabid = 1 union
select 'andy', 75, 'C', 'X' from systables where tabid = 1 union
select 'mick', 65, 'D', 'X' from systables where tabid = 1 union
select 'pete', 44, 'C', 'X' from systables where tabid = 1 union
select 'samantha', 77, 'C', 'Y' from systables where tabid = 1 union
select 'holly', 22, 'D', 'Y' from systables where tabid = 1 union
select 'jane', 43, 'C', 'Y' from systables where tabid = 1 union
select 'melanie', 200, 'D', 'Y' from systables where tabid = 1
into temp t1 with no log ;
select 1 sgn, 'C' status from systables where tabid = 1 union
select -1, 'D' from systables where tabid = 1
into temp fudge with no log;
select dept, employee_name, employee_amount, t1.status, employee_amount, sgn
from t1, fudge
where t1.status = fudge.status
order by dept, employee_name
end
format
before group of dept
print "Dept: ", dept
skip 1 line
on every row
print employee_name, 2 spaces, employee_amount, 2 spaces, status
after group of dept
skip 1 line
print "Total: ", group total of ( employee_amount * sgn ) using "-<<<&"
skip 2 lines
end
which gives me:
Dept: X
andy 75 C
ian 100 D
mick 65 D
pete 44 C
Total: -46
Dept: Y
holly 22 D
jane 43 C
melanie 200 D
samantha 77 C
Total: -102
That do it for you?
- Paul (not a spokesman)