Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
kdmarkee
Specialist
Specialist

Load specific files from a directory using FileTime

In my QlikView script, I want to load all pdf files with a Date Created date of today, and although is seems simple to do, I cannot seem to get anything working.  Using these examples, can someone help with the code?  Thanks.

My directory:  \\NP\DemogData\

My Files all have different names...

  • Today's files:  file01.pdf, file02.pdf, file03.pdf (the sript should load these)
  • Older files in the directory:  file22.pdf, file36.pdf, file 45.pdf (the script would ignore these)

Thanks.

Labels (1)
1 Solution

Accepted Solutions
Nicole-Smith

Code like this should work (I've tested on my own items):

FOR EACH vFile in FileList('\\NP\DemogData\')
	IF FileTime('$(vFile)') >= DAYSTART(NOW()) THEN
    	TRACE Load $(vFile);
    ENDIF
NEXT

 

You might need to update the FileList statement to use the connection where your files are (in case I don't have it fully correct).  You would then add your load statement inside of the IF/ENDIF where the TRACE is.

View solution in original post

2 Replies
Nicole-Smith

Code like this should work (I've tested on my own items):

FOR EACH vFile in FileList('\\NP\DemogData\')
	IF FileTime('$(vFile)') >= DAYSTART(NOW()) THEN
    	TRACE Load $(vFile);
    ENDIF
NEXT

 

You might need to update the FileList statement to use the connection where your files are (in case I don't have it fully correct).  You would then add your load statement inside of the IF/ENDIF where the TRACE is.

kdmarkee
Specialist
Specialist
Author

Thanks a bunch!  I was over complicating it... I was trying to write code that would only look at date for the loading and probably didn't have my loop logic correct either.  Your code is simple and gets the job done, works great.