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: 
Not applicable

Reload an application based on the existence of a txt file

Hello,

I would liek to refresh my QlikView application based on the presence of a txt file.
If the file exists, I can load my application with the code:


let path_prices = 'ok.txt';

for each File in filelist (path_prices)

myTab:

LOAD* from TABLE

NEXT;

However, if the file doesn't exist, my app is blank.
I would like to make a loop for a time on the directory to start loading the application once the txt file is created.


Do you have an idea please?

Thanks you

8 Replies
Anonymous
Not applicable
Author

Hi Stephane,

I would go at it this way:

LET vExist = ifnull( filetime('uvw.txt));

IF $(vExist) = 0 //file exist

ELSE //it doesn't exist

maxgro
MVP
MVP

Anonymous
Not applicable
Author

Massimo, it is a txt file, not a QVD.

A

maxgro
MVP
MVP

I know; in that post there are answers for qvd and txt (and links to other answers too). My answer above all was to kindly suggest that there is (upper right) a useful search function.............and a lot of answers are already here in the community

its_anandrjs

You can use FileSize() function also for checking the existence of the TXT file.

Not applicable
Author

Try this script. The first lines of the script should be the below part

if isnull(filesize('C:\Users\ABDC\Desktop\test.txt')) then

exit Script;

ENDIF

'The Rest of the script comes here.

its_anandrjs

You can try this load script for checking the file is present or not

Let vFileSize = FileSize('D:\YourFileLocationHere\Ok.txt');

If $(vFileSize)  = 0 then

LOAD *,'QVD file' as FileType

FROM

TableName.qvd

(qvd);

//EXIT Script;

ELSEIF $(vFileSize) > 0 then

TableName:

LOAD *,'TXT file' as FileType

FROM

[YourFileLocationHere\Ok.txt]

(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);

STORE TableName into TableName.qvd;

ENDIF

Note:- Change the file location as your file location.

Anonymous
Not applicable
Author

My bad Massimo