Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Not applicable

Avoiding the creation of an empty qvd

We have an intermittent problem with an incrementing load which seems to fail sometimes but only on some monday mornings ... we have diagnosed the issue is down to the Script which creates a new incremental qvd every monday by doing :

Newfile:
Load * where Id > LastLoadedID
...
Store into .... QVD.

On next interval it does a FinD max LastLoadedID in Newfile.QVD as you would expect.

The Problem Occurs when it finds no records on the first run of a monday morning. it Stores the QVD with no rows but the filesize is greater than 0 this casues All subsequent loads to fail as the LastLoadedId for the Next run is Null.

the Fix appears to be not to store thefFile if there are no rows, but How do I create the logic to store the qvd only if tableRows exist ?

ColinR

Tags (1)
5 Replies
prieper
Honored Contributor II

Avoiding the creation of an empty qvd

Would suggest to test the table on the content with the NoOfRows()-function, with this your script may look like:

Newfile:
Load * where Id > LastLoadedID;
...
IF NoOfRows('Newfile') > 0
THEN Store Newfile into .... QVD;
ELSE
TRACE No new records found!;
END IF


HTH
Peter

Not applicable

Avoiding the creation of an empty qvd

Pete,

Looks like that is what im looking for

Cheers

francoiscave
Contributor III

Re: Avoiding the creation of an empty qvd

Hi Peter,

I think that "then" must be in the same line that the "if" statement... Like below:

Newfile:

Load * where Id > LastLoadedID;

...

IF NoOfRows('Newfile') > 0 THEN

Store Newfile into .... QVD;

ELSE

TRACE No new records found!;

END IF

From the QlikView help:

Since the if..then statement is a control statement and as such is ended with either a semicolon or end-of-line, each of its four possible clauses (if..then, elseif..then, else and end if) must not cross a line boundary.

Thanks for this script,

François

balkumarchandel
Valued Contributor II

Re: Avoiding the creation of an empty qvd

Hi Colin,

Find attached incremental load script with empty QVD logic.

Modify script as required.

neetha_p
Honored Contributor

Re: Avoiding the creation of an empty qvd

Hi,

Try:

Products:

Load * Inline

[

Name,value

A,1001

B,1002

C,1003

D,1004

];

LET vNoOfRows = NoOfRows('Products');

If $(vNoOfRows) > 0 then

  Store Products into Products.qvd (QVD);

  DROP Table Products;

ELSE

  ProductsOld:

  LOAD Name,value

  FROM

  Products.qvd

  (qvd);

  Store ProductsOld into Products.qvd (QVD);

  DROP Table ProductsOld;

END IF