Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Folks,
i have a question,
is there any examples, where i can see how to check my folder, i mean: if i create a qvd-file then this qvd-file will be stored in the folder. i want to check whether my folder is empty or not. if my folder is empty, so the qvd-file should be stored, if my folder is not empty, then should be not.
Does anybody have any idea how to handle this issue?
Thanks a lot
Beck
if the folder is not empty, it will contain the same qvd u'll be storing?
I have this code at the start of my script to see if the QVD exists:
LET vListqvdexists=isnull(QvdCreateTime('lib://QVDS/DTRAK\$(vCurrentYear)\Load\StopData$(vCurrentYear).QVD')); // if qvd exists then 0 else -1
Then further down the script I check the value of this variable and then do what I need to do
Hi Omar,
thanks a lot for your responce.
If my folder is not emtpy then qvd should be not stored
Hi Mark thanks a lot for your responce,
do you have the whole example to this part of checking of qvd?
if it's the case, or u know the name of the probably existing file, or use the *.fileextension, if u're not sure of its name
do sthing as follow:
SET ErrorMode=0;
LOAD data from the probably existingFile;
then delete what u've imported
if ScriptError>0 then
store ur Qvd
end if
SET ErrorMode=1;
With that, what we're doing, is :
1) negating the fact that qlik stop the reloading process if there is an error
2) try to import sthing from the file that could be in ur folder (then delete it)
3) if it's there, u won't do anything
if it's not, so normally that should be an error (if ScriptError>0 then)
=> store ur qvd
Hi Omar thanks a lot for your help,
i tried to to check this procedure on the base of your example, but i didn't achieve the right solution
I'm using this approach in another workcase, and it does work for me.
Well, hope u'll find the right way to do it !
Have a nice day Beck
Omar Thanks a lot for your help and time
That is the bulk of the code.
The variable will contain a 0 or -1.
In my script I check the variable for a 0 (meaning the QVD does exist) and then do whatever logic I want to do based on it already existing. Or I could do the opposite and check for a -1(does not exist)
We create QVDs that are year specific and have the year in the name. So when we rolled into the new year I needed to do something different on the first day since it didn't exist. After that I go back to my normal routine.