Skip to main content
Solved

Assigning ascending ID to duplicate values - ignoring unique values


Hi all,

I would like to add a field to my vector data assigning a sequential ID to duplicate values. However I would like to ignore unique values leaving them with a COUNT of 0.

This table can hopefully explain what I would like to achieve better than me attempting to write it!

VALUECOUNT103051525354607172

 

I started off with a Statistics Calculator grouping by my VALUE using the Total Count Attribute and the Cumulative output port. This counts each unique value sequentially but it also assigns a COUNT of 1 to unique values.

Is there another way of finding duplicates apart from the Duplicate Filter first? The Duplicate Filter doesn't appear to filter the truly unique values from duplicates. As in a the first VALUE of 7 and 5 would go through the unique port then the further 7 and 5 values would pass through the duplicate port.

I hope this makes sense to someone!

FME version 2019.1.0.0

Best answer by ebygomm

Use a matcher to find all non-unique values and send them to a counter with a count start of 1 and using the value attribute as the counter name, all unmatched values get set with a value of 0

View original
Did this help you find an answer to your question?

3 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • August 14, 2019

First use the StatisticsCalculator (group by value, using numeric count), followed by a Tester (_count = 1) to define all unique values. Use an AttributeCreator on the Passed port of the Tester to add the attribute Count (value 0).

Then use a Counter transformer on the Failed port of the Tester (start at 1, using the Value attribute as the name of the counter).

That should give you the above result.


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • Best Answer
  • August 14, 2019

Use a matcher to find all non-unique values and send them to a counter with a count start of 1 and using the value attribute as the counter name, all unmatched values get set with a value of 0


debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • August 16, 2019

If the VALUE attribute values in your data will always be sorted like they are in the example you posted above (ie. like values grouped together), then another potential method is using conditional values in the AttributeManager with Adjacent Feature Attributes enabled.

Create the COUNT attribute first and set the attribute value to 0 using an AttributeCreator. Then use an AttributeManager with Adjacent Feature Attributes enabled for 1 prior feature and 1 subsequent feature. Use the following conditional statements:

This should create the output that you want.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings