Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
madhuqliklondon
Creator II
Creator II

Script help???

I am trying get script which will execute if it is Monday of the week or else it will exit and if its 2nd day of the month it will execute or else it will exit. I will schedule this script in nprinting every day. As I know in nprinting I can only schedule it for only one type either weekly or monthly. If I schedule it for every day,  reads the scripts and execute accordingly. Hope this make sense. Just need script to put it at the top the query I have.

1 Solution

Accepted Solutions
sunny_talwar

May be this

IF WeekDay(Today()) = 'Mon' or Day(Today()) = 2 then

     TableName:

     LOAD ....

     FROM ...;

     ......

ENDIF;

Anything between IF and ENDIF will only run if it is Monday or 2nd day of the month....

View solution in original post

5 Replies
vishsaggi
Champion III
Champion III

May be this?

IF ( WeekDay(Today()) = 'Mon'  OR

       Today() = Date(Num(Monthstart(Today())+1)) , 'ExecuteScript' , 'Exist Script')

madhuqliklondon
Creator II
Creator II
Author

Hi, Vishwa,

, 'ExecuteScript' , 'Exit Script') this bit is coming with red undrlined??

sunny_talwar

May be this

IF WeekDay(Today()) = 'Mon' or Day(Today()) = 2 then

     TableName:

     LOAD ....

     FROM ...;

     ......

ENDIF;

Anything between IF and ENDIF will only run if it is Monday or 2nd day of the month....

Anonymous
Not applicable

Is that all Nprinting does for you?  Are you using it as a scheduler to run your script?

Using the if statement in a load script will make the QVW empty on the days it shouldn't run.

But it won't stop the rest of your Nprinting process (like export) unless you put a condition on your report.

vishsaggi
Champion III
Champion III

Follow Sunny's Script. Its simple and comprehensible.

I was little lazy sorry about that. Its Monday morning thing. 🙂

I actually meant like

IF ( WeekDay(Today()) = 'Mon'  OR

       Today() = Date(Num(Monthstart(Today())+1))  Then

Your execution load script

ELSE

Exit Script

END IF;