Hej @voornaam :) you can generate these numbers using a Counter transformer. Set Count Start to 1, set Count Scope to Local, check the box Group Processing and select Group By = "Mile". Then use an AttributeCreator to add -1, -2, -3, etc. to Mile using "@Value(Mile)-@Value(_count)".
Feed features into a Counter with a Group By set to 'Mile', and set the start to 1. Then ExpressionEvaluator to add the count to the original Mile.
@nielsgerrits @dustin
Wow, thank you for your fast reply's! I've tried both your ideas and they give me the same output, looks good. The next thing I'm trying to tackle is that there are IDs that have a unique Mile number, they get a -1 added as well. Is there some way to use an if like statement that says something like if the Mile number is unique don't add a number and if it occurs more than once, add a number. Any ideas?
I was thinking something like creating a list with Mile numbers that occur just once and use that in some sort of filter?
I was thinking something like creating a list with Mile numbers that occur just once and use that in some sort of filter?
Another option is to use a matcher, send the output from the matched port to your counter, then send the unmatched to an AttributeCreator/Manager to set the -1 figure
@dustin @nielsgerrits Thanks guys. Helped me a lot. What I ended up doing was using two conditional values in the Attribute creator. For objects with a unique Mile number use the existing one and add a number with Mile numbers that occur more than once.
Im back.. I'm having to rebuild my bench in FME 2021.0. For the Counter transformer there is no option 'Group By'. Any suggestions on how to solve this?
Im back.. I'm having to rebuild my bench in FME 2021.0. For the Counter transformer there is no option 'Group By'. Any suggestions on how to solve this?
If you set the Counter Name parameter to an attribute that will peform your group by.