Skip to main content
Solved

Add a specific text as header and footer of text file

  • October 11, 2023
  • 2 replies
  • 92 views

arash_hokm
Contributor
Forum|alt.badge.img+8

Hello FME Community,

 

I am using a 'StringConcatenator' and a 'Text Writer' to create a text file. I intend to add two separate texts as the header and footer.

 

Is there a way to add these texts without duplication?

 

Best answer by nielsgerrits

One way to do this:

  • Sampler to get a single line feature from the data features and use this feature to create the header and the footer features.
  • AttributeCreators on the header, data and footer streams with an attribute "order" with the values 1, 2 or 3.
  • Sorter to sort on the attribute order.
  • Connect to the writer.
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.

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+62
  • Best Answer
  • October 11, 2023

One way to do this:

  • Sampler to get a single line feature from the data features and use this feature to create the header and the footer features.
  • AttributeCreators on the header, data and footer streams with an attribute "order" with the values 1, 2 or 3.
  • Sorter to sort on the attribute order.
  • Connect to the writer.

arash_hokm
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • October 11, 2023

One way to do this:

  • Sampler to get a single line feature from the data features and use this feature to create the header and the footer features.
  • AttributeCreators on the header, data and footer streams with an attribute "order" with the values 1, 2 or 3.
  • Sorter to sort on the attribute order.
  • Connect to the writer.

@nielsgerrits​ Thank you very much.

It worked.