[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] Printing on the first line
- Subject: RE: [sqr-users] Printing on the first line
- From: Bob Stone <bstone@fastenal.com>
- Date: Mon, 14 Mar 2005 08:52:33 -0600
- Delivery-date: Mon, 14 Mar 2005 09:53:48 -0500
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
I can think of 2 possibilities.
First, figure out which line "Total salary: xxxx" will go on. I assume
there would be some sort of header rows, so maybe it would be on the 4th
line. Set your rownum to 5, and print each row after that through your SQL.
'0001' '5000', and so forth. Then at the end, you know your sum, and you
can print using rownum of 4 again. In this case you have to have some sort
of 'write_to_csv' procedure. For example, if you wanted to print a number
on a specific column you could:
let $to_write = 'C' || $rownum || $column || ';K' || $actual_output_data
write #file from $to_write
The second possibility, probably less work for you, but also less
efficient...if that matters to you in your specific environment. Run
through your SQL you use for the sum once at the beginning to get the sum.
Print your total. Then run it through again to look at each specific row,
printing as you go.
begin-sql
sum(columns_you_need) $total
write 1 from 'total salary: ' || $total
from table a, table b
where a.key = b.key
end-sql
write 1 from 'emplid' || $tab || 'salary'
begin-sql !same from clause.
emplid
salary
write 1 from $emplid || $tab || $salary
from table a, table b
where a.key = b.key
end-sql
-----Original Message-----
From: sqr-users-bounces+bstone=fastenal.com@sqrug.org
[mailto:sqr-users-bounces+bstone=fastenal.com@sqrug.org]On Behalf Of
Manoj Singh
Sent: Monday, March 14, 2005 4:02 AM
To: This list is for discussion about the SQR database reporting
language from Hyperion Solutions.
Subject: [sqr-users] Printing on the first line
Hi Guys,
I have a requirement in which I am creating a csv file and where I am
summing up a field after the last record I have fetched I have to put that
value on the first line of CSV file .Is it possible in CSV File ? I have one
option where I can write a sql for sum(salary) write it into the file and
then fetch one by one row and write in a CSV file. Is there any other
option.
eg.
o/p Should be
Total salary :10500
emplid salary
0001 5000
0002 3000
0003 2500
--
India.com free e-mail - www.india.com.
Check out our value-added Premium features, such as an extra 20MB for mail
storage, POP3, e-mail forwarding, and ads-free mailboxes!
Powered by Outblaze
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users