Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
I am trying to check if the qvd exists, using the QVDCreateTime function.
I am facing an error- it executes with zero lines fetched....
My script is below:
SET vPathQVD ='\\fillup\Qlikview\'
SET vStartYear = Year(Today())-3;
SET vEndYear = Year(Today())+1;
SET vHIEndYear =Year(Today())+1 ;
SET vHDateYear = Year(Today())-3;
FOR vYearQVD = $(vStartYear) to $(vHIEndYear) step 1
LET vQVDfile = vPathQVD & 'Hotel Inv '& vYearQVD & '.QVD';
LET vListQVDExists = NOT isnull(QVDCreateTime('$(vQVDfile)'));
IF $(vListQVDExists) THEN
[Hotel Inv]:
LOAD *
FROM [$(vQVDfile)] (qvd)
WHERE [HDate] >= '$(vHDateYear)';//'2013';
ENDIF;
NEXT; //end of load loop
Thanks in advance...
Try stepping through the code using Debug mode in script editor. Check that every variable is evaluated and set correctly to expected value.
I think you should use LET instead SET here:
SET vStartYear = Year(Today())-3;
SET vEndYear = Year(Today())+1;
SET vHIEndYear =Year(Today())+1 ;
SET vHDateYear = Year(Today())-3;
Try this approach may be for checking:
SET vPathQVD ='\\fillup\Qlikview\'
SET vStartYear = Year(Today())-3;
SET vEndYear = Year(Today())+1;
SET vHIEndYear =Year(Today())+1 ;
SET vHDateYear = Year(Today())-3;
FOR vYearQVD = $(vStartYear) to $(vHIEndYear) step 1
LET vQVDfile = vPathQVD & 'Hotel Inv '& vYearQVD & '.QVD';
LET vListQVDExists = If(FileSize(vQVDfile) > 0, -1, 0);
IF $(vListQVDExists) then
Try stepping through the code using Debug mode in script editor. Check that every variable is evaluated and set correctly to expected value.
I think you should use LET instead SET here:
SET vStartYear = Year(Today())-3;
SET vEndYear = Year(Today())+1;
SET vHIEndYear =Year(Today())+1 ;
SET vHDateYear = Year(Today())-3;
No.. Same result...0 lines fetched...
That was a good suggestion.
I found one of the variables not being assigned a value...
Thanks.
It worked with the variable getting its value.
Thanks.
Awesome. I suggest marking Stefan's answer as correct and close the thread down.
Best,
Sunny