Skip to main content

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)

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)


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.


Reply