I look for a method that can add a blank line between field names and data into CSV Writer.
Any idea?
Thanks an advance.
FarFar
I look for a method that can add a blank line between field names and data into CSV Writer.
Any idea?
Thanks an advance.
FarFar
There may be several ways.
An easy way:
Add a Creator transformer to the workspace and connect it to the CSV writer.
Geometry Object: Null
Number to Create: 1
Create At End: no
But the CSV writer will write commas anyway. If you don't want to write commas, the solution will be a little more complicated.
Wouldn't you like to write commas into the line?
Takashi
Thank you for your response.
No. I don't like to write commas into the line.
FarFar
Space would need be enclosed in these separators.
Maybe you should write it as a txt. And use 2 or more spaces as separator.
( and make sure attribute values have max. 1 space in succesion max, if at all)
Entering 2xnewline character for blank line is of course not an issue, thats easy.
Insert a StringConcatenator before the writer to create a csv line (comma-separated attribute values) for each feature. Set the concatenated attribute name to "text_line_data".
Add a Creator to create a feature; connect an AttributeCreator to add an attribute named "text_line_data" to the feature, set the value to comma-separated field names followed by one newline character. And then send the feature to the writer.
Note that a value should be surrounded by double quotations before the concatenation if it contains a comma.
I'm following you method but i dont show a blank line !
this is my example to do it :
Any idea?
Thanks an advance.
Farfar
FarFar
How about this then?
If you dont want last blank line, remover last line_number...after sorting.
Always KO.
i add 2 newlines likes :
I was able to get the required result with just one newline character, so I'm not sure why you had to add two newlines.
I tested it with FME 2014 SP4 and 2013 SP4.
Which version are you using?
My problem is not resolved :)
i will migrate to SP3 to test if its OK.
Farfar
I installed SP4 but my problem isn't resolved !
Any idea ?
Thanks
I installed SP4 but my problem isn't resolved !
Any idea ?
Download (https://drive.google.com/file/d/0B0ufVP2t0eApVXl3V21kZ1AzX1k/view?usp=sharing)
I can always run it successfully with FME 2013 SP4.
I compared a two workbench and the difference is that my writer is saved as a txt file. So no blank line between fields names and data.
If a specify that is a csv file writer, it works like your example.
Thank you.
Farfar
Thanks a lot Takashi. It works your example.
I compared a two workbench and the difference is that my writer is saved as a txt file with .txt extension. So no blank line between fields names and data.
If the writer is a text file WITH CSV EXTENSION, it works like your example.
Thank you.
Farfar