Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
Maybe something like this:
if hour(now()) >= 14 and hour(now()) <= 17 then
exit script;
else
load ...
end if
- Marcus
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...
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
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.
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
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;
I would have expected a result of 'Do Not Load'?
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
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