Skip to main content
Solved

Continuation of feature counting

  • February 10, 2021
  • 2 replies
  • 45 views

chrbalm
Contributor
Forum|alt.badge.img+8

I am looking to see if there is a method of setting a 'continuation' for counting features in FME.

Essentially I have 300 features with a UID of a simple number (1,2,3 etc). I wanted to see if there was a way for when I add additional features into the mix, the UID would automatically populate continuing with the next available UID (i.e. 301)

Best answer by caracadrian

There's probably a few solutions to this problem, here is how I would solve it.

 

Assuming that your original data is coming in ordered (if not could use a sorter on the id field), take the last feature (#300) then merge this onto your new data. You new data needs to have an increasing count on it. Then add the increasing count to the value of the last feature.

Screenshot 2021-02-11 100617 

See the attached workbench as well (2020.1)

You should never assume that your incoming data is sorted or the data is consistent (1001, 1002, 1004 - notice the missing 1003).

Use a StatisticsCalculator to get the .max of the attribute you want and set your Counter Count Start parameter to .max+1. A simple AttributeManager with a conditional value to populate the UID only when is doesn't have a value will finish the job.

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

hkingsbury
Celebrity
Forum|alt.badge.img+65
  • Celebrity
  • February 10, 2021

There's probably a few solutions to this problem, here is how I would solve it.

 

Assuming that your original data is coming in ordered (if not could use a sorter on the id field), take the last feature (#300) then merge this onto your new data. You new data needs to have an increasing count on it. Then add the increasing count to the value of the last feature.

Screenshot 2021-02-11 100617 

See the attached workbench as well (2020.1)


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • Best Answer
  • February 11, 2021

There's probably a few solutions to this problem, here is how I would solve it.

 

Assuming that your original data is coming in ordered (if not could use a sorter on the id field), take the last feature (#300) then merge this onto your new data. You new data needs to have an increasing count on it. Then add the increasing count to the value of the last feature.

Screenshot 2021-02-11 100617 

See the attached workbench as well (2020.1)

You should never assume that your incoming data is sorted or the data is consistent (1001, 1002, 1004 - notice the missing 1003).

Use a StatisticsCalculator to get the .max of the attribute you want and set your Counter Count Start parameter to .max+1. A simple AttributeManager with a conditional value to populate the UID only when is doesn't have a value will finish the job.