Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
DataKnight1
Contributor III
Contributor III

Only Reload a QlikView document between two times

Hi - I want to include some logic in my load script that says only reload if it 's between 2 times, and if not then exit script.

For example, if the reload time is >=14:00 and <= 17:00 then exit script, else load...

I'm struggling to see anything relating to this. 

Thanks

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

sorry - pick() is wrong here, try:

let a = HOUR(NOW());
let b = NOW();
trace $(a);
trace $(b);

if match($(a),10,11,21,22,23,0,1,2,3,4) then
trace 'Do Not Load';
else
trace 'Do Load';
end if;

- Marcus

View solution in original post

8 Replies
marcus_sommer

Maybe something like this:

if hour(now()) >= 14 and hour(now()) <= 17 then
   exit script;
else
   load ...
end if

- Marcus

DataKnight1
Contributor III
Contributor III
Author

Thanks for the quick response - I've actually got the below in my script, but it isn't working;

IF HOUR(NOW()) >= 21 AND HOUR(NOW()) < 5 THEN

My hour right now is '14', so I would expect the script to exit, however, it isn't and proceeds to connect and load...

marcus_sommer

I assume you execute this task on your server. If so take a look on its time (the server might be any time zone) which may different to your time.

- Marcus

DataKnight1
Contributor III
Contributor III
Author

I'm working locally at the moment, attempting to get it to work before doing anything re; server deployment.

I'm surprised, as I thought it would be a frequently asked question.  I'm aware that with Publisher, you can select reload options, however, I do not have Publisher, so want to do it in the load script.

marcus_sommer

Just to check the times put a few trace-statements into the script, like:

let a = HOUR(NOW()); let b = NOW();
trace $(a); trace $(b);

and then maybe:

if pick(match($(a), 21,22,23,0,1,2,3,4) then
   trace '... then part ...';
else
   trace '... else part ...';
end if

What happens now - if anything is strange it should be popup now ...

- Marcus

DataKnight1
Contributor III
Contributor III
Author

So, I've got the below;

let a = HOUR(NOW());
let b = NOW();
trace $(a);
trace $(b);

if pick(match($(a),10,11,21,22,23,0,1,2,3,4)) then
trace 'Do Not Load';
else
trace 'Do Load';
end if;

With the result of;

DataKnight1_0-1602063769222.png

I would have expected a result of 'Do Not Load'?

marcus_sommer

sorry - pick() is wrong here, try:

let a = HOUR(NOW());
let b = NOW();
trace $(a);
trace $(b);

if match($(a),10,11,21,22,23,0,1,2,3,4) then
trace 'Do Not Load';
else
trace 'Do Load';
end if;

- Marcus

DataKnight1
Contributor III
Contributor III
Author

Hi Marcus - yes, this gives the desired result - I'll be able to build on this logic now - thanks for your help - I'll mark this as completed!

Have a great day.

Simon