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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Lazar1
Contributor III
Contributor III

Loading the file, if exists, by using variables

Hi,

I want to create a script that loads xlsx file each day if the file exists. If not, just skip for that date.

I get an error message on vFileExsist variable (see below). I assume that an issue is because I am trying to load from lib: which is not the correct path for this case.

SET vFileName='lib://Geo/SPGI_$(vToday).xlsx';

Let vFileExsist=if(FileSize($(vFileName))>0,-1,0); // error ( The following error occurred:Unexpected token: 'Metrics', expected one of: ',', ':', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', ...

if $(vFileExsist) then

For_Upload:

NoConcatenate
LOAD
PO_ID as PO_ID_FOR_UPDATE,
FINAL_RCA as FINAL_RCA_FOR_UPDATE,
"Comment"
FROM [lib://Geo/SPGI_$(vToday).xlsx]
(ooxml, embedded labels, table is in)

where isnull(FINAL_RCA)<>0;

 

Thanks in advance for help.

Labels (1)
1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can try:

Let vFileExsist=if(FileSize('$(vFileName)')>0,-1,0);

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

3 Replies
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can try:

Let vFileExsist=if(FileSize('$(vFileName)')>0,-1,0);

Help users find answers! Don't forget to mark a solution that worked for you!
Cascader
Creator
Creator

Hi, 

you can use the following expression to check if the file exists:

 

Let vFileExsist = Num(-(not isnull(QVDCreateTime('$(vFileName)'))));
Lazar1
Contributor III
Contributor III
Author

Apparently this worked fine 🙂