Solved

Identify duplicate attributes and only keep attribute with the most recent date.


Badge

Hello,

I don't know the best way to go about this, I've been trying to set some conditional statements in my AttributeManager but I'm unable to get the results I'm after.

I'd like to identify the duplicate serial numbers (API NUMBER 10) in my data and then only keep the duplicate that has the most recent date (WELL STATUS DATE).

Thanks in advance for your help.

icon

Best answer by ciarab 17 May 2017, 01:06

View original

3 replies

Badge +9

If you put the data through a sorter and order by your date attribute descending and then use the duplicate filter you should be left with the most recent date coming through the unique port

Badge

If you put the data through a sorter and order by your date attribute descending and then use the duplicate filter you should be left with the most recent date coming through the unique port

Thank you @ciarab.

 

Userlevel 2
Badge +17

Hi @ngstoke, you also have other choices. Assuming that the records have been originally sorted by API_NUM_10 and WELL_STATE_DATE ascending.

1. AttributeCreator + Tester

0684Q00000ArLPaQAN.png

2. Aggregator + ListIndexer

 

0684Q00000ArLO9QAN.png

3. The InlineQuerier could also be used even if the source records have not been sorted.SQL Query Example:
select a.*
from InputTable as a
inner join (select API_NUM_10, max(WELL_STATUS_DATE) as maxDate
    from InputTable group by API_NUM_10) as b
on a.API_NUM_10 = b.API_NUM_10 and a.WELL_STATUS_DATE = b.maxDate
order by a.API_NUM_10

Reply