Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
naziralala
Creator
Creator

QVD Exists Check

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...

1 Solution

Accepted Solutions
swuehl
MVP
MVP

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;

View solution in original post

6 Replies
sunny_talwar

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

swuehl
MVP
MVP

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;

naziralala
Creator
Creator
Author

No.. Same result...0 lines fetched...

naziralala
Creator
Creator
Author

That was a good suggestion.

I found one of the variables not being assigned a value...

Thanks.

naziralala
Creator
Creator
Author

It worked with the variable getting its value.

Thanks.

sunny_talwar

Awesome. I suggest marking Stefan's answer as correct and close the thread down.

Best,

Sunny