Skip to main content
Question

assign count to unique attribute values

  • January 8, 2018
  • 7 replies
  • 86 views

Hi, I would like to assign a unique count as a new attribute, based on the value of an existing attribute. I cannot find a solution: Counter, UniqueValueLogger and StatisticsCaltulator seem not be suitable for this. It is a large database. How do I manage this? I am not interested in the number of Pete's, Daisy's.

Example:

Old attributeDesired attributePete1Pete1Jacob2Daisy3Daisy3Daisy3

 

 

Sieger

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.

7 replies

erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • January 8, 2018

I would use the DuplicateFilter followed by a Counter.

Then a FeatureMerger to merge the desired attribute on the original rows merging on the old attribute.

If the data is in a database (Oracle in my example), you could use two SQLCreators:

1) Complete table

2) Select old attribute, rownum from table.

Then a FeatureMerger to merge the rownum as desired attribute on the complete table.


lau
Forum|alt.badge.img+3
  • January 8, 2018

Hi,

You can use an AttributeCreate and enable adjacent feature attributes (see my workspace)example.fmw


takashi
Celebrity
  • January 8, 2018

Hi,

You can use an AttributeCreate and enable adjacent feature attributes (see my workspace)example.fmw

Excellent. Also you can use the Default Value option, so that the conditional value setting could be simpler a little.

 

 

 


mark2atsafe
Safer
Forum|alt.badge.img+59
  • Safer
  • January 8, 2018

To throw out another idea, use an Aggregator-Counter-Deaggregator combination.


Forum|alt.badge.img
  • January 8, 2018

You can use a Matcher based on the Old Attribute and use the generated Match ID Output Attribute.

Note that you will have to deal with the features coming out of the NotMatched port and assign them a value by yourself.


takashi
Celebrity
  • January 9, 2018

There is more than one way. Assuming the records are sorted by the Old attribute, this workflow is also possible.


Thank you all! Glad that it works now...