Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have implemented a script that I found in the community that will be triggered on a daily basis, but only completes successfully if the daily table that it is referencing holds data for the current day. Every time the condition that checks if there is data for today is not met, the for loop restarts after it sleeps for 10 minutes. Most of the time, the daily table is ready in the morning, but on occasion the table will not be ready until later in the afternoon, or even the next day.
Here is the script:
LET vCase_2 = null();
//start loop
Do until vCase_2 = 'go'
trigger_tmp:
SELECT
CASE WHEN CLOSE_WEEK_END_DATE = to_char(sysdate,'YYYYMMDD')
THEN 1
ELSE 0
END AS CASE
FROM
(SELECT max(DAILY.CLOSE_WEEK_END_DATE) CLOSE_WEEK_END_DATE
FROM DAILY_TABLE DAILY)
;
Trigger:
LOAD
IF(CASE = 0,'stop','go') AS CASE_2
RESIDENT trigger_tmp;
DROP TABLE trigger_tmp;
LET vCase_2 = peek('CASE_2',0,'check');
// where condition is met, exit and complete.
if vCase_2 = 'go' then
Exit Do
// where condition is not met, drop that table ready to restart the load process.
else
DROP TABLE Trigger;
Sleep 600000; // 600000 milliseconds = 10 minutes.
end if
// where condition is not met then restart loop.
loop
Thanks in advance for your help!
We do the same thing on multiple applications. If you have multiple tasks that run in the QMC, you need to check the Max number of simultaneous QlikView engines for distribution , because the default is 4. The task that is waiting is taking up 1 of those engines.