Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi community,
I just wrote my first If statement in the script (below) but QlikSense is telling me their is a script error. Refer to screenshot attached. But it loads fine. Just annoying it says there is an error.
Any idea why?
The "CRASH" statement is just to highlight what I want the script to do, which is to crash so it doesn't reload anything and reverts to the last saved version.
//Load in the current employee view and check if it contains data, if it does not, exit script so it does not reload and produce errors
LIB CONNECT TO 'HR_SECURE (qh_blunckc)';
CurrentEmployeesCheck:
LOAD *;
SQL SELECT *
FROM DwhDataMart.hr."vw_current_EmployeeData"
Where CleanHolderFlag = 1 and not(ProfessionalStream='Contractor');
If NoOfRows('CurrentEmployeesCheck') = 0 THEN;
CRASH;
End If
Drop Table CurrentEmployeesCheck;
Hi @blunckc1
Did you take the ending semicolon (;) as suggested? Now to raise an error in the script, the following document How to raise or throw an error in QlikView or Sense explains how to raise an error if a load condition is not fulfilled.
I tested the logic with the following code:
If NoOfRows('Sales') > 0 then
trace No Data;
CALL ThrowError ('Required file $(vFileName) not found on FTP');
End Ifhth
Hi @ArnadoSandoval ,
No change. Exit script will update the data model with a table of 0 rows, which I want to avoid. I need the script to fail, so it reverts to it's last saved version and doesn't reload anything.
Cheers
Carl
Hi @blunckc1
Did you take the ending semicolon (;) as suggested? Now to raise an error in the script, the following document How to raise or throw an error in QlikView or Sense explains how to raise an error if a load condition is not fulfilled.
I tested the logic with the following code:
If NoOfRows('Sales') > 0 then
trace No Data;
CALL ThrowError ('Required file $(vFileName) not found on FTP');
End Ifhth
Thanks for the new code mate! That worked a treat and now no error is showing 🙂
Appreciate your time and effort!
Cheers
Carl