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: 
thabo2g5
Contributor III
Contributor III

Get a MAX date out of a list of logfile that is timestamped

Hi everyone

i have a logfile that is timestamp so what i want to do is to load the last date of this logfile i tried  this

timestamp:

                              Load FileName() as filename,

                              FileSize() as filesize,

                              FileTime()  as [Time],

                              Date(Floor(FileTime())) As DateField,

   Time(Frac(FileTime())) AS TimeField

                                                                                                                                                                       

FROM

[Folder]

(txt, unicode, no labels, delimiter is ' ', msq) ;

it brings all the logfile name and date but what i want is to have the recent date only not others

i've attached the outcome fron the above code

thank you in advance

2 Replies
Anil_Babu_Samineni

Perhaps this?

timestamp:

                              Load FileName() as filename,

                              FileSize() as filesize,

                              FileTime()  as [Time],

                              Date(Floor(FileTime())) As DateField,

   Time(Frac(FileTime())) AS TimeField

                                                                                                                                                                      

FROM

[Folder]

(txt, unicode, no labels, delimiter is ' ', msq) ;

Right Join (timestamp)

Load Max(DateField) as DateField Resident timestamp;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
rubenmarin

Hi Thabo, if you want to recover only last file maybe this code works:

For each vLastFile in FileList('C:\Test\*.txt')

NEXT

At the end of the bucle the variable vLastFile should have the value of the last file and you can use this value to load only this file.

Maybe it needs a second variable inside the If that checks if the current file in the bucle is more recent than the previous, and use this second variable to load the last log.