Skip to main content

I have two tables, they have the unique ID to compare with each other. There is another column called year in both tables.

I am hoping to find records in table2 with the same ID in table1 and then compare the 'year' attribute, only keep the latest one.

Which transformer should I use? The feature joiner can find all records in table 2, but it can't dynamically decide which one to keep.

 Screenshot 2021-03-16 121032

One way to do this is using the StatisticsCalculator. Group by ID, max Year.

workspaceresult 


One way to do this is using the StatisticsCalculator. Group by ID, max Year.

workspaceresult 

Thanks for your help. It works perfectly.

 

 

 

 


You could also use a sorter followed by a duplicatefilter

Sort on Year in Descending order, then a duplicatefilter with the Key attribute set to ID. The features with the latest year will exit via the unique port


Reply