Sat 19 Nov 2005
I don’t get to code much SQR in my current job, this is something new I learned recently.
Do you know that SQR supports writing CSV reports using its print command? In the column number, specify the column number as it will be displayed in Excel. For example, a 3-column sheet, the SQR code looks like this:
print "Column 1" (1,1)
print "Column 2" (,2)
print "Column 3" (,3)
print $line1a (+1,1)
print $line1b (,2)
print $line1c (,3)
print $line2a (+1,1)
print $line2b (,2)
print $line2c (,3)
SQR takes care of the formatting if the value being printed contains embedded commas and quotes. To instruct SQR to print in CSV mode, the -EH_CSV should be added to the SQR command-line parameters. In Process Scheduler, it adds this parameter if you choose CSV as the output format.
March 6th, 2007 at 1:09 am
This is not working. I tried printing two different columns but they are overlapping.
Are the print commands correct?
Can you give me some woring code. I need it urgently…
Regards
Abhinav
March 7th, 2007 at 11:14 pm
Abhinav, are you sure you’re running your SQR program with -EH_CSV command line parameter? Also, what version of SQR are you running? The feature is only available in versions 4.3.1 up.
June 28th, 2007 at 9:35 pm
Hi
I have a problem in a CSV file, generated with SQR. A data is too large (more than 200 characters). It fills a cell, but the next datas of the same line have to be set a line under (but they keep the same column)
Is there a way to control data length on an Excel cell, using a SQR function ?
Thanks in advance.
February 6th, 2008 at 7:41 pm
Hi,
Can we do cell formatting in a csv file using sqr? Like, i would like some cells to be merged, some cells to have a background colour, some text to be bolded etc.
Thanks in advance
February 12th, 2008 at 12:21 am
Deepa,
SQR doesn’t support output to Excel natively. Your options probably are to use the xml format for Excel or SYLK. Check out the following libraries:
http://sourceforge.net/projects/sqr2xml
http://www.ontko.com/sqr/sylk.html
April 29th, 2008 at 9:52 am
ChilliJoe,
We can use HTML tags in SQR to write an xls file.
Open $filename as 2 for-writing record=20000 status=#filestat2
Write 2 from ”
Write 2 from ”
Write 2 from ”
Write 2 from ‘Heading1′
Write 2 from ”
Write 2 from ”
Write 2 from ‘Heading2′
Write 2 from ”
!Select data in begin select and write it
write 2 from ”
write 2 from ”
write 2 from $selected variable
write 2 from ”
write 2 from ”
Write 2 from ”
Close 2
We can use the same approach to write an xls file in app engine peoplecode. I think we can use HTML tag properties for , also.
April 29th, 2008 at 10:34 am
I was talking about html tags like table , tr , th and td .
we have to give the complete tag as a string
“”
“”
“”
July 24th, 2008 at 11:55 am
SQR is the MOST SUCK program i meet.
Frankly, if you use “write” function you can edit your delimeter if you output your file as CSV, handy while you have “comma” inside your data to output. But you wont be able to edit mask feat, so whenever you need to write a “2.00″ float as “2″ integer to file, you need to
1. assign float > integer
2. move integer to string var
3. write out your string var by using “write” command,
it’s like hell when you have over 10 integer to writeout for each row
if you use Print command you can save the 3 steps above by
Print #my_integer (, +1) 999
But….
if your row has a cell with “comma” value
E.g. a cell “Dept, Section”
Then you will doom coz YOU WILL NEVER ABLE TO CUSTOM YOUR DELIMETER in CSV, YOU ARE FORCE TO USE “,” comman
Till now i cant find the solution