Skip to main content
Question

Group records based on attribute values

  • Jul 11, 2017 12:37 PM UTC
  • 3 replies
  • 270 views

Forum|alt.badge.img+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

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

pratap
Contributor
Forum|alt.badge.img+12
  • Contributor
  • Jul 11, 2017 12:41 PM UTC

Hi,

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

Pratap


ebygomm
Evangelist
Forum|alt.badge.img+54
  • Evangelist
  • Jul 11, 2017 12:42 PM UTC

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


takashi
Celebrity
  • Jul 11, 2017 12:49 PM UTC

Hi @aquamarine, how about this expression?

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