Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
if QvdNoOfRecords('Qvd name')<=0
EXIT SCRIPT
ELSEIF store qvd into path.qvd(qvd);
ENDIF
Before loading statement, you need to put below condition to check..
IF (qvdNoOfRecords('$(Path)') <= 0) THEN
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 , 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.
if QvdNoOfRecords('Qvd name')<=0
EXIT SCRIPT
ELSEIF store qvd into path.qvd(qvd);
ENDIF
Before loading statement, you need to put below condition to check..
IF (qvdNoOfRecords('$(Path)') <= 0) THEN
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
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 ?
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 ?
If your code will exit after checking first qvd then it'll not go to script further.
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 ?
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
I am using binary load of 1st qvw in 2nd qvw