Focal Point
[CLOSED] How can I insert newline characters for csv files.

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/226100445

October 08, 2010, 01:01 AM
ANDYFISH
[CLOSED] How can I insert newline characters for csv files.
Hello everybody.

I will appreciate you if you can help with this problem:
I am trying to output my data to a csv file.
and I want to manually insert a newline(or enter?sorry my english is poor) character,and I tried a lot :

BY CATE1 AS 'CATE1","shot",CRLF,"","","","","","","","","'

see that I succeeded in output blank columns but however I can't insert a newline though I replaced the 'CRLF' with '\r\n' and anything possible else.

Please Help me !!!...

and forgive my poor english.

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6
Linux, CSV

MAN FROM PRC
October 08, 2010, 01:09 AM
Waz
Why do you want to put a CR in yopur CSV file ?

Is this to be added to a title ?

Can you post the whole TABLE request?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 08, 2010, 01:18 AM
ANDYFISH
quote:
Originally posted by Waz:
Why do you want to put a CR in yopur CSV file ?

Is this to be added to a title ?

Can you post the whole TABLE request?


Because the report I want to create contains headers and I found that the header will not be outputed in csv format,so I wanted to insert header by editing the titles.

And this is my whole request,you can ignore the japanese...

-------------------------------------------
-* File REI702B.fex
JOIN 担当者.担当者.担当者番号 IN 担当者 TO MULTIPLE 売上実績.売上実績.担当者番号 IN 売上実績 TAG J0 AS J0
TABLE FILE 担当者
SUM
売上金額
粗利額
BY 地区名
BY 分類名1 AS '分類名1","shot",CRLF,"","","","","","","","","'
BY 担当者名
WHERE 地区名 EQ '&AREA.(FIND 地区名,地区名 IN 売上実績).地区名を選択して下さい.';
WHERE 分類名1 EQ '&CATEGORY.(FIND 分類名1,分類名1 IN 売上実績).商品分類を選択して下さい.';
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SAVE FILENAME
"C:\&AREA|地区&CATEGORY|売上.CSV"
FORMAT COMT
---------------------------------------------

Thank you .


WebFOCUS 7.6
Linux, CSV

MAN FROM PRC
October 08, 2010, 02:21 AM
<JG>
If you want to create a csv file with a header row use format COMT or DFIX
October 08, 2010, 02:45 AM
GamP
quote:
format COMT or DFIX
In my 7.7.01 setup format COMT provides column headers, but only on one line and format DFIX does not even give me that.
If you want a complete report with headers, footers and column titles and such, try holding it format WP. That way you still have a columnar hold file, but with all headers and such present. Mind you, no master file will be created, but if you need that you could probably create one yourself.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
October 08, 2010, 07:27 AM
<JG>
Gamp for DFIX

ON TABLE HOLD FORMAT DFIX HEADER YES

Generates the header row

But you are correct using FORMAT WP is the only way you will get a multi-line header
FILEDEF MYFILE DISK MYFILE.CSV
-RUN
DEFINE FILE CAR
HLINE1/A50='"分類名1","shot"';
HLINE2/A50='"","","","","","","","",""';
END
TABLE FILE CAR
"<HLINE1"
"<HLINE2"
BY COUNTRY NOPRINT
ON TABLE SET PAGE NOLEAD
ON TABLE HOLD AS MYFILE FORMAT WP NOCC
END
-RUN
FILEDEF MYFILE DISK MYFILE.CSV (APPEND
-RUN
TABLE FILE CAR
PRINT COUNTRY MODEL
ON TABLE SAVE AS MYFILE FORMAT COM
END
-RUN  

October 08, 2010, 07:33 AM
GamP
quote:
HEADER YES

Never too old to learn something new, am I Wink


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988