Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to check if files exist.

Hi,

I want a piece of script that will set a variable to '1' if files exist in a location. then if the variable is '1' i want run that particular piece of script. if not i want to skip it.

I basically want to check that the files in the location are great than 0.

The location will hold several QVD's with the same name and the date on the end.

e.g.

Location= C:\QV

Sales012013.qvd

Sales022013.qvd

Sales032013.qvd

So if Sales*.qvd>0 then run script.

Can anyone help?>

2 Replies
swuehl
MVP
MVP

Try maybe something similar to what Henric suggested here:

http://community.qlik.com/message/340253#340253

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this script

SET vFileName='Refund.qvd';

// Set a variable indicating if the file exists or not. -1 is True, 0 is False

LET vFileExists = if(FileSize('$(vFileName)') > 0, -1, 0);

IF $(vFileExists) THEN       

    Data:  

    LOAD *

    FROM $(vFileName);   

ELSE                       

     MsgBox("File Not exists.");

END IF;

Hope this helps you.

Regards,

Jagan.