Re: Structure of ACE report for totalling
Posted in 1997
ian clark (ian@tubeway-army.demon.co.uk) wrote: : Imagine, if you will, 2 table of the following format: : employee_name CHAR(20) : employee_amount SMALLINT : status CHAR(1) : dept CHAR(1) : And some test data such as this: : ian,100,D,X : andy,75,C,X : mick,65,D,X : pete,44,C,X : samantha,77,C,Y : holly,22,D,Y : jane,43,C,Y : melanie,200,D,Y Here's a report: ------------------------------------------------------------------------- database foo end output left margin 0 end select emp_name, emp_amt, status, dept from ian order by dept end format before group of dept print "Dept: ", dept skip 1 line on every row print emp_name clipped, 1 space, emp_amt using "<<<<", 1 space, status after group of dept skip 1 line print "total: ", (group total of emp_amt where status = "C") - (group total of emp_amt where status = "D") using "-<<<<" skip 1 line end ------------------------------------------------------------------------- that produces this output: ------------------------------------------------------------------------- Dept: X andy 75 C mick 65 D ian 100 D pete 44 C total: -46 Dept: Y samantha 77 C holly 22 D melanie 200 D jane 43 C total: -102 ------------------------------------------------------------------------- Now, personally, I think it would look nicer with the amounts all lined up, and some lines between departments, or something like that, but hey, I work in Support. I try to deliver exactly what the customer asked for ;) June ---- June Tong Informix Software ---- ---- Senior Consultant (650) 926-6140 ---- ---- International Support junet@informix.com ---- ---- Location-du-jour: Menlo Park ---- * * Standard disclaimers apply * - Please do not send me requests/questions by mail. When I have the knowledge - and time permits, I try to answer questions on comp.databases.informix, but - travel schedule, time, and volume make responding to personal requests - difficult and often slow. Please call your local Informix Technical Support - organization for assistance with technical issues.