Skip to main content
Solved

Adding header lines to textfiles


femo
Contributor
Forum|alt.badge.img+6
  • Contributor

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

View original
Did this help you find an answer to your question?

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+17
  • 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
itay wrote:

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+17
  • Supporter
  • May 11, 2017
femo wrote:
Hi @itay,

 

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

 

Thanks a lot!

 

 

Glad I could help!

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings