Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Manni_SM
Contributor III
Contributor III

specific date

Hi All

i have qliksense application usally we are running manually evrymonth 10th  .

now customer is asking to run it automatically every month 10 

conditons:  if 10th day is saturday or sunday (weekend) it should run on monday

and exclude all holidays  also 

this should be done in Qliksense script  not from qmc.

any sample Qliksense app is there that will be helpful

how to do any ideas suggestions ?  @Vegar  @rubenmarin1  @QFabian 

Labels (2)
4 Replies
rubenmarin1

Hi, you can load the app every day, or from 10th to 13th, 14th, 15th, or wathever day that can avoid many consecutive holidays... it's not clear what it should do if 10 is saturday or sunday, and the next monday is holiday.

At the start of the script you can load a table with all holidays, the check the date and that table to load a flag, something like:

LET vMonthlyLoad = If(Num(WeekDay(Today())>=5 or Exists('HolidayDate',Date(Today(),'DateFormatOfHolidays')
  ,0
  ,If(Month(ReloadTime())=Month(Today())
    ,0
    ,If(Day(Today()<10
      ,0
      ,1)));

I haven't tested so maybe there is some kind of error, the intention is:

- If today is is saturday, sunday or holiday -> don't load

- If the app has already being loaded this month -> don't load

- In other case, if day is above 10 -> load the app

So if 10 was saturday, 11 is sunday, 12 and 13 are holidays, then it will load on 14th, and on 15th it will not load because it has been already loaded this month on 14th.

Then after that just add:

IF $(vMonthLoad)=0 THEN
    Exit Script;
ENDIF 

And after this the rest of the script

lennart_mo
Creator
Creator

Hi,

the method @rubenmarin1 suggested should work, the only problem I see, is that there'd be no data available after the Exit script statement, since the the script would've run successfully. 

So you'd probably need to store all tables after reloads matching the criteria and load the data from those QVDs on all other loads.

rubenmarin1

True, I was thinking in a layer development, and that will be on the app that generates the data for the user app.

Vegar
MVP
MVP

A way around this problem could be to use the app it self as a source during weekends and holidays 

IF $(vMonthLoad)=0 THEN
    Binary LIB://reference_to_your_app;
    Exit Script;
ENDIF 

 

This will keep the data as is, and you won't have an issue with an empty app.

 

Another solution is to force an script error every time the weekday condition is not met. (I don't enjoy this solution my self, but I've seen it around.)

IF $(vMonthLoad)=0 THEN
    This row causes an error;
ENDIF