Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Fix this issue

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;

17 Replies
maxgro
MVP
MVP

perhaps because this is always true?

and ( Hour(now(1)) <> 18 or Hour(now(1)) <> 19 or Hour(now(1) <> 20 ))

Not applicable
Author

Hi ,

Thanks for the reply ,

yes.. but how can we change this code so that it has to run only in between 6 to 8 pm onSunday?

Not applicable
Author

Please reply somebody..

I need help immediately

maxgro
MVP
MVP

pseudo code

if (

     (sunday and (17 or 18 or 19))

     or

     (startmonth and (7 or 8 or 9))

     ) then

     go

else

     exit

endif

Not applicable
Author

Have you tryed to debug it?

tresesco
MVP
MVP

For 6 to 8 pm:

Frac(Now())>=1/24*18 and Frac(Now())<=1/24*20

maxgro
MVP
MVP

try this

LET vGo =if(

// saturday at 17 18 19

(num(WeekDay(today()+0))=5 and ( match(Hour(now(1)), 17,18,19 )))

or

// 1st ofmonth at 7 8 9

(Day(today())=1and ( match(Hour(now(1)), 8,9,10 )) ),

1, 0

)

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

So that would be:

Let vExecuteWeeklyFlag = WeekDay(today(1)) = 'Sun' And 18 <= Hour(Now(1)) And Hour(Now(1)) <= 20;

Let vExecuteMonthlyFlag = Day(today(1)) = 1 And 7 <= Hour(Now(1)) And Hour(Now(1)) <= 9;

If Not(vExecuteWeeklyFlag) And Not(vExecuteMonthlyFlag) Then

     Trace $(vExitMessage);

     Exit Script;

End If

I have taken the liberty of changing the sense of the flags to match the flag name (execute flag should be true() to execute).

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

But it has to run  using  UTC()  time...

I tried with Tue as day and time as 6 to 8 pm ,,,its working ..if we change the hours other than that say 2 to 5 pm its also working....

but when we change the day as Mon and run within 6 to 8 pm its also running which is not correct...