Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Test the file existence in a multi source load thanks to filesize()

Hey!

After severals minutes navigating the forum to find the answer of the problem I've met, I decided to ask for help.

I met some difficulties to load in Qlik Sense all the files contained in a folder thanks to 'Filesize' function.

So, I tried to test the file existence in a loop durinq the loading script like below:

These files names are like (file1.xlsm, file2.xlsm,...)

set a = 1;

Do while a<10

Let taille = FileSize ('\\folder\file$(a).xlsm');

If taille <>0 then

[BDD]:

LOAD

... 

FROM [lib://folder/file$(a).xlsm]

(ooxml, embedded labels, table is BDD);

endif

Let a=a+1;

Loop

But in the debug mod, the var 'taille' does not return the size of the file.

I hope that I'm clear in my explanation.

Thanks for you help

(Sorry for my english)

2 Replies
Gysbert_Wassenaar

The FileSize function also needs to use a lib reference. Unless you enable the legacy script mode. See the help file: http://help.qlik.com/sense/2.1/en-US/online/#../Subsystems/Hub/Content/Scripting/FileFunctions/FileS...

But why not use a wildcard load?

BDD:

LOAD

...

FROM [lib://folder/file*.xlsm]

(ooxml, embedded labels, table is BDD);


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Actually, I don't know why I did not think about this easier solution before!

However, thanks for this information and your quick answer.

Regards