Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a REST connection that is bringing in data from a web service every 5 minutes using the scheduler in the QMC. I also have 6 files that call on SQL Server for data that usually stays the same but could change. I would like to set up my app so that Qlik only loads those files weekly. Is it possible to have the app on a schedule to load every 5 minutes but only load the other files weekly?
You can put the calls you want to do weekly within a if condition. and load it only on a certain day of the week and before certain time
e.g. Load it only on Mondays and approxiate time of first run on monday is before 1 am
If WeekDay(today())=1 and hour(now()) <1 then
//your load statements
end if
or you could instead of time you could use a temp table which you set a flag save it as qvd and manipulate so that it will run only on first run of monday
e.g.
LoadPerformedTempTable:
LOAD * from [lib://FolderConnection/LoadPerformed.qvd] ;
let vLoadPerformed =
Peek('LoadPerformed',0,'LoadPerformedTempTable');
drop table LoadPerformedTempTable;
If WeekDay(today())=1 and vLoadPerformed=0 then
/**
Add your weekly load statements
**/
// Mark load as performed so that load is performed only once on monday
LoadPerformedTempTable:
load * inline [
LoadPerformed
1
];
Store * from LoadPerformed into
'lib://FolderConnection/LoadPerformed.qvd';
drop table LoadPerformedTempTable;
elseif WeekDay(today())=2 then
//On tuesday mark it back to zero so that first run next monday
//everything will load
LoadPerformedTempTable:
load * inline [
LoadPerformed
0
];
Store * from LoadPerformed into
'lib://FolderConnection/LoadPerformed.qvd';
drop table LoadPerformedTempTable;
end if