Skip to main content
Solved

Control feature append order

  • October 17, 2017
  • 5 replies
  • 39 views

Forum|alt.badge.img

Hi,

I have a workspace with two creators which I use to create a single constant text line each. The rest of the workflow reads data and creates text lines depending on the content of the data (10 lines in this example). Now I want to write the text line of the first creator first to a text file, then the lines generated dependent on the data and the text line from creator_2 last. As Creator_2 is much faster then reading all the data in between, in the resulting text file I get the text line from Creator_1 first, then the line from Creator_2 and the lines from the data last. Is there a way to control that the line created by Creator_2 is written last?

So far I can only see that the Creator order can be controlled...

thanks,

Ludwig

Best answer by dustin

On the feature coming out of the first Creator, use your AttributeManager_1 to create an attribute of 'sort_att' with a value of 1. Use a Counter on the content data, with Count Output Attribute set to 'sort_att', and Count Start set to 2. On the last feature, use your AttributeManager_6 to create an attribute of 'sort_att' with a value of 9999 (just a number bigger than the number of content data features). Then feed all features into a Sorter prior to output, sorting Numerically and Ascending based on the attribute 'sort_att'.

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.

5 replies

thomas_merkus
Contributor
Forum|alt.badge.img
  • Contributor
  • 10 replies
  • October 17, 2017

Maybe you can combine a FeatureHolder, and a Sorter to make sure the features arrive in the right order to the Writer.


danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • 2077 replies
  • October 17, 2017

Maybe you can combine a FeatureHolder, and a Sorter to make sure the features arrive in the right order to the Writer.

Great suggestion @thomas_merkus

 


dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • 629 replies
  • Best Answer
  • October 17, 2017

On the feature coming out of the first Creator, use your AttributeManager_1 to create an attribute of 'sort_att' with a value of 1. Use a Counter on the content data, with Count Output Attribute set to 'sort_att', and Count Start set to 2. On the last feature, use your AttributeManager_6 to create an attribute of 'sort_att' with a value of 9999 (just a number bigger than the number of content data features). Then feed all features into a Sorter prior to output, sorting Numerically and Ascending based on the attribute 'sort_att'.


takashi
Celebrity
  • 7843 replies
  • October 17, 2017

If there is no blocking transformer on the data flow from the reader (10 text lines), you can just set "Yes" to the Create At End parameter in the Creator_2.


Forum|alt.badge.img
  • Author
  • 5 replies
  • October 17, 2017

On the feature coming out of the first Creator, use your AttributeManager_1 to create an attribute of 'sort_att' with a value of 1. Use a Counter on the content data, with Count Output Attribute set to 'sort_att', and Count Start set to 2. On the last feature, use your AttributeManager_6 to create an attribute of 'sort_att' with a value of 9999 (just a number bigger than the number of content data features). Then feed all features into a Sorter prior to output, sorting Numerically and Ascending based on the attribute 'sort_att'.

@cartoscro: That's it. Very useful easy transformers. I am a FME noob, but start to love it more and more!