Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Let vExecuteWeeklyFlag=WeekDay(today()) <> 'Sun' and ( Hour(now(1)) <> 18 or Hour(now(1)) <> 19 or Hour(now(1) <> 20 ));
Let vExecuteMonthlyFlag=Day(today()) <> 1 and ( Hour(now(1)) <> 7 or Hour(now(1)) <> 8 or Hour(now(1) <> 9));
Let vExitMessage = 'This code should execute only on Sunday and hour is 7 PM or 8 PM or 9 PM. Or MOnth start between 7-9 PM. Current time is $(vUTC).Hence exiting script without taking a snapshot';
According to this the qvw has to run only on Sunday in between 7 PM or 8 pm or 9 pm. otherwise it has to show the exit message.
but when i am running this qvw its running other than specified time in Sunday.SO how to fix this issue.
If($(vExecuteWeeklyFlag)) and ($(vExecuteMonthlyFlag)) then
trace $(vExitMessage);
exit script;
Endif;
you can try with below code:
WeekDay(Today()) ='Sun' and (Hour(now())=18 or Hour(now())=19 or Hour(now())=20)
in your check...
Its working for this timezone ..if we change the time other than this also its working..say time b.w 5 to 7 it should not work ..it has to show the message..but its loading ..how to solve this?
Your code is possibly failing because of improper use of 'OR' and 'AND'. It has to be something like:
(condition for weekday) AND (condition for hour)
as per the code which you have sent its working for within the time zone (6 to 8 pm) ragne whcih is correct..but if we change the time zone to other say 4 to 7 pm it still loading which is not correct..SO how to fix it?
perhaps with?
LocalTime([timezone [, ignoreDST ]])
Returns a timestamp of the current time from the system clock for a specified time zone. The timezone is specified as a string containing any of the geographical places listed under Time Zone in the Windows Control Panel for Date and Time or as a string in the form 'GMT+hh:mm' or 'UTC+hh:mm'. If no timezone is specified the local time will be returned. If ignoreDST is -1 (true) daylight savings time will be ignored.
date(localtime('UTC') , 'hh:mm:ss')
localtime('UTC')
if(WeekDay(Today()) ='Sun' and (Hour(now())=18 or Hour(now())=19 or Hour(now())=20)) then
load * from temp;////Script...
else
message
endif;
I hope it should work with your server timezone, Check It. Hope it will give solution
Regards,
Chinni Kanna
Hi all ,
Thanks for the reply .. the actual problem is ..
I have a qvw which should run only on every Sunday at 6pm to 8 pm and monthly first day at 6 pm to 8 pm based on UTC time.
according to my code its running on sunday and month first day correclty at 6 to 8 pm...
but its also running the qvw on sunday other than 6 pm to 8 pm which is not correct... how to solve this issue?
the code is:
Let vExecuteWeeklyFlag=WeekDay(today()) <> 'Sun' and ( Hour(now(1)) <> 18 or Hour(now(1)) <> 19 or Hour(now(1) <> 20 ));
Let vExecuteMonthlyFlag=Day(today()) <> 1 and ( Hour(now(1)) <> 7 or Hour(now(1)) <> 8 or Hour(now(1) <> 9));
Let vExitMessage = 'This code should execute only on Sunday and hour is 7 PM or 8 PM or 9 PM. Or MOnth start between 7-9 PM. Current time is $(vUTC).Hence exiting script without taking a snapshot';
If($(vExecuteWeeklyFlag)) and ($(vExecuteMonthlyFlag)) then
trace $(vExitMessage);
exit script;
Endif;