Skip to main content
Solved

Adding header lines to textfiles

  • May 10, 2017
  • 4 replies
  • 185 views

femo
Contributor
Forum|alt.badge.img+6

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!

Best answer by itay

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

Forum|alt.badge.img

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.


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • Best Answer
  • May 10, 2017

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


femo
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • May 11, 2017

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!

 

 


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • May 11, 2017
Hi @itay,

 

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

 

Thanks a lot!

 

 

Glad I could help!