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: 
mohan2391
Creator II
Creator II

Reload should fail if QVD size is zero

Hi,

 

I have a requirement where the reload of QVW should stop when the size of QVD which I am loading in the QVW is zero.

How to achieve this ?

 

Thanks in advance

 

3 Solutions

Accepted Solutions
vvvvvvizard
Partner - Specialist
Partner - Specialist

if QvdNoOfRecords('Qvd name')<=0
EXIT SCRIPT
ELSEIF store qvd into path.qvd(qvd);
ENDIF

View solution in original post

shiveshsingh
Master
Master

Before loading statement, you need to put below condition to check..

IF (qvdNoOfRecords('$(Path)') <= 0) THEN 

View solution in original post

Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you want a task furter up in the QMC chain to not run when a QVD is found to be empty, let your script crash if you detect no loaded rows. I often use a self-invented statement called CRASH; to do this Smiley Wink, because QlikView doesn't supply something similar. Your script then becomes

TableSomething:
LOAD * FROM SomeFile (SomeOptions);

IF NoOfRows('TableSomething') = 0 THEN
  CRASH;
END IF

Of course, the task will fail and you will get an appropriate email scream from the QDS. But the second task will not run.

 

View solution in original post

17 Replies
vvvvvvizard
Partner - Specialist
Partner - Specialist

if QvdNoOfRecords('Qvd name')<=0
EXIT SCRIPT
ELSEIF store qvd into path.qvd(qvd);
ENDIF

shiveshsingh
Master
Master

Before loading statement, you need to put below condition to check..

IF (qvdNoOfRecords('$(Path)') <= 0) THEN 

Peter_Cammaert
Partner - Champion III
Partner - Champion III

As a second method, you can leave the LOAD logcic unchanged and add a test after the LOAD statement has been executed. Although the overhead of loading the XML header twice is not that large, you skip at least one of them. E.g.

 

TableSomething:
LOAD * FROM SomeFile (SomeOptions);

IF NoOfRows('TableSomething') = 0 THEN
  EXIT SCRIPT;
END IF

 

 

mohan2391
Creator II
Creator II
Author

Hi,

 

Thanks for your quick reply.

I forgot to mention 1 point, so please let me know if this code satisfies that or no.

Missed Point: I have 2nd QVW which runs after successful run of 1st QVW(here in 1st qvw, we are writing that above code) one.

So my requirement is that the 2nd QVW also should not run if the QVD size is zero along with the failure of 1st QVW.

 

So the code which you suggested can work for my other requirement as well ?

mohan2391
Creator II
Creator II
Author

Thanks for your reply, same question to you as well.

 

I forgot to mention 1 point, so please let me know if this code satisfies that or no.

Missed Point: I have 2nd QVW which runs after successful run of 1st QVW(here in 1st qvw, we are writing that above code) one.

So my requirement is that the 2nd QVW also should not run if the QVD size is zero along with the failure of 1st QVW.

 

So the code which you suggested can work for my other requirement as well ?

shiveshsingh
Master
Master

If your code will exit after checking first qvd then it'll not go to script further.

 

 

mohan2391
Creator II
Creator II
Author

it will not go to the further script in the SAME qvw (that means in 1st QVW)

But my question is, I have 2 QVWs. In QMC, there are 2 tasks created on these and there is task dependency created between them so that 2nd QVW will start run once 1st qvw runs successfully.

 

In the 1st QVW, I want to check QVD size is zero or not. If it is zero it should stop immediately AS WELL AS it SHOULD NOT allow 2nd QVW to run. So the 2nd QVW will run or no if I use your code and the QVD size is zero ?

Joost_d
Partner - Contributor
Partner - Contributor

 

DataFromQvd1:
Load 
  * 
from Qvw1;
//If you have publisher, use variable below in QMC
Let vNoOfRecords =NoOfRecords() ;

Store DataFromQvd1 into DataFromQvd1.qvd (qvd);

//running second Qvw conditionally
Let NoOfQvd1Records= QvdNoOfRecords(DataFromQvd1);

If $(NoOfQvd1Records) >0 then
     //Run Second Qvw
     DataFromQvd2: 
     Load * from Qvw2;
     Store DataFromQvd2 into DataFromQvd2.qvd (qvd);
Else
    //Exit Script               
Endif
mohan2391
Creator II
Creator II
Author

I am using binary load of 1st qvw in 2nd qvw