Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Highlighted

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
Highlighted

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

Highlighted
Specialist
Specialist

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.