Skip to main content
Solved

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

  • May 16, 2017
  • 3 replies
  • 266 views

ngstoke
Contributor
Forum|alt.badge.img+1

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.

Best answer by ciarab

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

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

ciarab
Contributor
Forum|alt.badge.img+9
  • Contributor
  • Best Answer
  • May 16, 2017

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


ngstoke
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • May 16, 2017

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.

 


takashi
Celebrity
  • May 20, 2017

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