Question

Make a CSV Template


Hello,

 

I would like to know if it's possible to have a sort of tempalte for CSV files.

I will create many csv files that will look the same (on the left 4 headers with values that change) and after that, on the 3rd, 4th and 5th row, from the 3rd line down, i will write point coordinates.Plus, at the end of the point coordinates I will have some other information.

So is there a way in FME to make a CSV file that is already configured ? Because I was thinking of configuring it after with Python, but if it's possible in FME it will save me some time.

 

Thanks!

3 replies

Userlevel 2
Badge +17
Hi,

 

 

Just an idea.

 

How about using three CSV writers to write header, body and footer parts separately into the same file?

 

In the Navigator, arrange the order of the writers from header (top) to footer (down), and also make sure that "Position in Workbench Navigator" was set to the "Order Writers By" parameter (Navigator / Workspace Parameters / Advanced).

 

Link every Destination Folder parameter to the same Published Parameter.

 

Set "No" to the "Append to File" parameter for the first writer (header); set "Yes" to the parameter for other 2 writers.

 

Create output filename attribute in the data flow, and set it to the "CSV File Name" parameter for each writer feature type, so that the three feature types will write the three parts into the same file.

 

 

... hmm, perhaps Python is easier?

 

 

Takashi
Thank you very much Takashi!

 

 

I will try this and if it's too difficult i'll use Python :)
Userlevel 2
Badge +17
Another thought.

 

If it's possible to create whole text for a csv file as an attribute (text_line_data), probably you can use a Text File writer to write it. The Fanout Dataset option of the writer can be used to fanout destination files.

 

Reply