Skip to main content
Solved

Group Based - Select maximum value attribute and keep those records

  • December 16, 2020
  • 2 replies
  • 462 views

lambertus
Enthusiast
Forum|alt.badge.img+16

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

View original
Did this help you find an answer to your question?

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+16
  • Author
  • Enthusiast
  • December 17, 2020

Thanks @1spatialmary​! Works perfect.


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