Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I'm working on our load script and I'm running into a problem. We're implementing incremental load and I've got to call a stored procedure in SQL, but I'm having problems putting the call into an IF ELSE. Here's the code
if $(FirstReload) = true then
LOAD *;
SQL EXECUTE EV_TEST;
else
LOAD *;
SQL EXECUTE EV_TEST '$(vExecTime)';
end if
So what I'm seeing is when I run this:
The following error occurred:
Script line error:
The error occurred here:
else
So I'm not sure if I'm doing something incorrectly with my call to load the stored procedure, or if I have some syntax wrong with my IF ELSE.
Have you tried both sql statements separately without the if-then-else?
Syntax looks fine, your Stored Proc, is the input param mandatory or optional, as there is no param on the first call? Hence the SQL maybe throwing the error .
I've ran both without the IF ELSE and they both successfully run and bring back data. When I run without the param I get a tabled called EXECUTE EV_TEST. When I run it with the param I get a table called EXECUTE EV_TEST '2016-03-10 12:36:50' and that name changes with the timestamp. Both bring back the data I'm expecting and the correct data that correlates to having or not having the parameter.
The input param is optional. We pass nothing over if it's the first time we're loading data and we want to pass the whole set back to qlik. We pass the parameter if it's not the first load so we can get incremental data. I can run both in SQL and both return data to qlik.
Since you're using variables... did you enable Legacy Mode? See: Qlik Sense Legacy mode and Disabling standard mode ‒ Qlik Sense
Yes legacy mode is enabled. We've got some loading from disk as well so we've had to enable legacy mode for the app.
Curious. I'm afraid I don't know what's wrong. Can you try it in Qlikview too? Maybe you can generate a log file with more information that way.
Or try replacing one branch of the if statement with some code that can't fail: TRACE $(FirstReload) $(vExecTime);