Question

Group records based on attribute values

  • 11 July 2017
  • 3 replies
  • 59 views

Badge +1

Hi, I have a attribute field that contains decimal values. Eg: 84.2, 86.0, 85.1, 95.3, 94.3, 106.6.

I would like to create a new attribute field with an integer value that represents the different groups based on the proximity of values. ie: The records 84.2, 86.0 and 85.1 would have each have a 1 in the new attribute field; 95.3 and 94.3 would have a 2; and 106.6 would have a 3.

I can't work out the best way to do this. I tried rounding the values but that doesn't guarantee that items which should be in the same group will round to the same value.

Any advice?

I am using FME Desktop 2016.

Thanks


3 replies

Badge +2

Hi,

Conditional Value in Attribute creator or Attribute manager is another option based on Less than or greater value condition

Pratap

Userlevel 1
Badge +21

One possible way, which may or may not work, depending on how you wish to group is to sort by the attribute value and then use an attributecreator with advanced attribute handling. If the attribute value is within a certain difference (2 in the example below) of the previous attribute set the new attribute to be the same as the original. If it's not add 1

Userlevel 3
Badge +17

Hi @aquamarine, how about this expression?

@int(@Value(attr)/10.0)-7

Reply