Question %5d In Csv

ezequiel

Member
Hello, I'm exporting some data to CSV, and I need to send some LF characters in certain fields.

I've send CHR(10), CHR(13), CHR(11), CHR(93), "]", even "%5D", but doesn't work.

Is there a way to do this?

Progress 9.1C (still, I know), Windows (.1 workstations, Windows 2003R2 server.
 

LarryD

Active Member
try putting double quotes around the field within the csv... e.g.

Code:
put stream csv  unformatted
    '"' myfield skip restofmyfield '",' myotherfield ',' anotherfield skip.
 

GregTomkins

Active Member
According to the Internet, double-quotes should work and that's what Excel does if you save a cell containing a line break and then export it to CSV.

However, I couldn't make it work from Progress.
 

ezequiel

Member
Hello, thanks.
The SKIP "feeds" one line in the CSV, not inside the "field" and that's waht I need (I'm sorry, it wasn't clear)

CHR(10) does the same.
 

LarryD

Active Member
This is from a csv file that we create where the header line is broken into separate lines in the same row and it comes into Excel just fine.

Code:
        put stream rpt unformatted
                "CRM#,CRM Name,CustType,Cust#,Customer Name,"
                '"Total Sales$' skip string(end-date,"99/99/9999") '",'
                '"Stock Orders' skip string(end-date,"99/99/9999") '",'
                '"Emergency Orders' skip string(end-date,"99/99/9999") '",'
                '"DART Orders' skip string(end-date,"99/99/9999") '"'
                skip.

I would think that splitting a field up would work the same unless there are embedded quotes.
 

GregTomkins

Active Member
I quickly tried LarryD's example and it worked for me, so did my own example once I looked slightly more carefully. Excel is a bit weird how it displays cells with embedded LF's, but it works.

Code:
output to /u1/pwrbrkr/source/develop/foo.csv.
put unform chr(34) "hello world" chr(10) "this is great" + chr(34) skip skip.
 

Attachments

  • hw.png
    hw.png
    3.9 KB · Views: 8

ezequiel

Member
Didn't success, I managed another way to include the info.

I haven't explore every possibility because of the urgence to sent the CSV, maybe in a future....

(please excuse my english construction, not my mother tongue)

Thank you all!
 

LarryD

Active Member
If you would show us the the piece of code you were trying to use perhaps we could point out how to make it work. Also a small sample of the output csv file with your code.

Regardless, glad you had a workaround.
 
Top