Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
jackd9999
Contributor
Contributor

extract the latest row from a file

Hi

I have a file with an email address, a timestamp and a series of values on each line

I only want the line with the latest timestamp for the email address

I have set up a tFileInputDelimited component for the file bit I've hit a snag

i) i tried using tSortRow which sorts by email address and timestamp. This works but I don't really know what component goes next in the pipeline. tUniqRow doesn't seem to allow me to say I only want the latest timestamp

ii) i tried using tAggregateRow but I'm not sure how this relates to aggregation windows : I only want the latest row (by timestamp) for the email address, not the file. This may be "first" for the timestamp itself but I don;t see how I extract the other values - these I suppose should be "first" but only in relation to timestamp.

i guess i need the equivalent of sql windows partition. Any ideas ?

jack

Labels (3)
1 Reply
Anonymous
Not applicable

Hi

The 1st way is right, use tSortRow to sort the rows by timestamp (desc model), and then link tSortRow to a tMap where add a sequence ID to each row, filter the row which has sequence id==1, this is the latest row.

0693p00000AYgBfAAL.pngPlease try and let me know if you have any issues/questions.

 

Regards

Shong