Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
andrewmo
Contributor

Sleep for 5 minutes then restart load script

Hello

I have a load script that does a date check for last update time of a table. If that update time is NULL or the update time is not today then set variable to 1 else 0. How do script if the variable is 1 Sleep for 5 minutes then restart the load script. Here is the load statement I am using:

CHK:

LOAD Rec;

SQL

with ld as (

select TABLE_NAME, 

DEPENDENT_INI,

EXEC_DESCRIPTOR as EXECUTION,

INITIALIZE_TIME,

END_TIME,

DATEDIFF(mi,INITIALIZE_TIME,END_TIME) as StartToEnd_Mins,

ROWS_INITLY_LOADED,

ROWS_STAGED,

STATUS

from CR_STAT_EXTRACT

where STATUS in ('Success', 'Warning') --Only show loaded tables

and LOAD_POOL is not NULL

and CONVERT(date,INITIALIZE_TIME) = CONVERT(date,GetDate())

and DEPENDENT_INI NOT LIKE 'VR_%'

--and TABLE_NAME = 'ARPB_TRANSACTIONS'

)

SELECT MAX(CONVERT(date,END_TIME)) as Rec

FROM ld;

VAL:

LOAD DISTINCT Rec

,if(IsNull(Rec) OR Date(Rec) <> Date(Today()),1,0) as Fail

RESIDENT CHK;

LET vFail = PEEK('Fail','VAL');

Here is where I would put the Sleep and reload function.

Any help would be greatly appreciated.

Thanks

Tags (1)
1 Solution

Accepted Solutions

Re: Sleep for 5 minutes then restart load script

May be like this

IF $(Variable) = 1 then

     SLEEP 300000;

ENDIF;

View solution in original post

4 Replies

Re: Sleep for 5 minutes then restart load script

May be like this

IF $(Variable) = 1 then

     SLEEP 300000;

ENDIF;

View solution in original post

andrewmo
Contributor

Re: Sleep for 5 minutes then restart load script

I believe that will work for creating the 5 minute pause, but how do I script the restart of the initial load? I basically want to keep reloading in 5 minute intervals until the variable is 0.

Re: Sleep for 5 minutes then restart load script

May be using a for loop...

MVP
MVP

Re: Sleep for 5 minutes then restart load script

let vloop=1;

Do while vloop

    sleep 300000;  

     // add your check

     // and set vloop to 0

     // to exit the loop

loop