Skip to main content
Question

assign count to unique attribute values


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

7 replies

erik_jan
Contributor
Forum|alt.badge.img+18
  • 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
Evangelist
  • January 8, 2018
lau wrote:

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+45
  • 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
Evangelist
  • 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...


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