Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
naziralala
Contributor

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

Tags (1)
1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Re: QVD Exists Check

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
Highlighted

Re: QVD Exists Check

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

Highlighted
MVP
MVP

Re: QVD Exists Check

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

Highlighted
naziralala
Contributor

Re: QVD Exists Check

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

Highlighted
naziralala
Contributor

Re: QVD Exists Check

That was a good suggestion.

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

Thanks.

Highlighted
naziralala
Contributor

Re: QVD Exists Check

It worked with the variable getting its value.

Thanks.

Highlighted

Re: QVD Exists Check

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

Best,

Sunny