LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Getting the newest of duplicate records

    Employee
    Posted 08-05-2009 14:35

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: jhoward

    I have a file with multiple records for many of the contacts in the list but I only care about the most recent records for each unique contact. How would I do this? I don't really want to agg all the records; just get the newest one based on a date within each record.


  • 2.  RE: Getting the newest of duplicate records

    Employee
    Posted 08-05-2009 16:55

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: rabbott

    I've attached a graph that imports a CSV file containing a date column, converts the date string to a date data type, sorts the records according to the date in reverse order to place the record with the most recent date on top, then splits the top record from the group into a separate output.

    The graph is within the ZIP archive, along with the source CSV file. You'll need to point the CSV input node to the source file.

    Hope you find this useful.
    Attachments:
    ExtractNewestRecord.zip


  • 3.  RE: Getting the newest of duplicate records

    Employee
    Posted 08-05-2009 17:31

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: rabbott

    Hello Again,

    Upon further review, I believe I may have misinterpreted your initial message. It appears you wish to group records by Contact, then extract the most recent record from the group.

    To accomplish this, I've replaced the Split node with an Agg node and modified the Sort node to sort first on the "Visitor" column (which should be equivalent to Contact in your example), and then on the Date. The Agg node then groups by Visitor (which, again, would be Contact in your example) and emits the latest record.

    Attached is the modified graph. I apologize for any confusion.
    Attachments:
    ExtractNewestRecordForEachGroup.brg