Skip to main content
Solved

Assigning ascending ID to duplicate values - ignoring unique values

  • August 14, 2019
  • 3 replies
  • 198 views

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

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.

3 replies

erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • 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+44
  • Influencer
  • 3427 replies
  • 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+21
  • Safer
  • 648 replies
  • 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.