Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Announcement: Certain actions are currently causing a Page Not Found error. This is a known issue and we are working with the platform vendor to investigate and resolve it.
madhuqliklondon
Contributor 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

Re: Script help???

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....

5 Replies
vishsaggi
Esteemed Contributor III

Re: Script help???

May be this?

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

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

madhuqliklondon
Contributor II

Re: Script help???

Hi, Vishwa,

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

Re: Script help???

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....

Highlighted
atkinsow
Valued Contributor II

Re: Script help???

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
Esteemed Contributor III

Re: Script help???

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;