Solved

Adding header lines to textfiles


Badge

Hello,

I am processing data and write the results to Textfiles , using a fanout and the featurewriter.

Now i want to add some headerlines (read and blue) in front of the exported lines (black). Plase, refer to the screenshot.

The red lines are the same for any of the files. Only the blue line consistes of a constant part (file.) and

the filename which is individuel. The number of resulting Textfiles varies.

Any ideas are highly appreciated!

icon

Best answer by itay 10 May 2017, 19:47

View original

4 replies

Badge

Create an UniqueID attribute (I'd use counter), use AttributteValueMapper to create the lines you require using the ID attribute then remove the UniqueID attribute before writing.

Badge +16

Create a new attribute (header) that contains the header in an AttributeManager and create a second text_line_data attribute that concatenates the original text_line_data and the new header attribute.

To place the file name in the new header attribute use the fme_feture_type or fme_basename depending on you input data.

See the attached template.

adding-header-lines-to-textfiles.fmwt

Badge

Create a new attribute (header) that contains the header in an AttributeManager and create a second text_line_data attribute that concatenates the original text_line_data and the new header attribute.

To place the file name in the new header attribute use the fme_feture_type or fme_basename depending on you input data.

See the attached template.

adding-header-lines-to-textfiles.fmwt

Hi @itay,

 

nice approach! I added an aggregator because I got initially a header for each line.

 

Thanks a lot!

 

 

Badge +16
Hi @itay,

 

nice approach! I added an aggregator because I got initially a header for each line.

 

Thanks a lot!

 

 

Glad I could help!

 

 

Reply