Skip to main content
Solved

Group Based - Select maximum value attribute and keep those records

  • December 16, 2020
  • 2 replies
  • 540 views

lambertus
Enthusiast
Forum|alt.badge.img+24

Dear community,

I have a table with two records for which I want to get only the record where _min in row 2 is less compared to _min in row 1 (or using _max). Hence, for the table below I want to get the second row and all attributes from that row.

 

Any ideas?

 

FME Group Based Computation

Best answer by 1spatialmary

Hi @lambertus​ 

I have a couple of options for you, and a sample workspace:

(1) if you want to compare record 2 against record 1 (the previous) there is an advanced option in the AttributeManager transformer that means you can access values from adjacent features - this is method 1 in the attached workspace. Expose the _min value from the previous record and then use a Tester to compare the 2 values.

(2) if you want to get the lowest value from a group of records (with the same _edge_id value) then you can use the StatisticsCalculator to get the minimum of the _min value, grouping by _edge_id. The complete port outputs the original data with the calculation added. Then use a Tester again to compare the 2 values.

get_lowest_valueI think the second option is the one you need based on your question title.

Hope that resolves it for you

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.

2 replies

Forum|alt.badge.img+1
  • Best Answer
  • December 16, 2020

Hi @lambertus​ 

I have a couple of options for you, and a sample workspace:

(1) if you want to compare record 2 against record 1 (the previous) there is an advanced option in the AttributeManager transformer that means you can access values from adjacent features - this is method 1 in the attached workspace. Expose the _min value from the previous record and then use a Tester to compare the 2 values.

(2) if you want to get the lowest value from a group of records (with the same _edge_id value) then you can use the StatisticsCalculator to get the minimum of the _min value, grouping by _edge_id. The complete port outputs the original data with the calculation added. Then use a Tester again to compare the 2 values.

get_lowest_valueI think the second option is the one you need based on your question title.

Hope that resolves it for you


lambertus
Enthusiast
Forum|alt.badge.img+24
  • Author
  • Enthusiast
  • December 17, 2020

Thanks @1spatialmary​! Works perfect.