Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld online is next week! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nakul1001
Creator II
Creator II

Application reload on certain working days of a month

Hello Qlik Experts,

I am trying to solve for a reload frequency /schedule and need some help.

For my application , I need the reload to happen only on a certain days of every month:  5th Working Day, 6th Working Day ,  12th Working Day and 13th Working day.

We use publisher and QMC and I believe at the moment there is no direct way to schedule a task for above frequency.

Please correct me if I am wrong.

I may have an option to let the reload run daily however tackle this in the script via implementing an IF condition (eg : if <5th working Day or 6th Working day ...etc>  then  <proceed to build data model> else exit script; end if )  , I am trying to make use of functions: today() ; DayNumberOfYear & weekday but could not still arrive to a working logic.

Could anyone please suggest a workaround?

Tx

Nakul

1 Solution

Accepted Solutions
swuehl
MVP
MVP

To check the 5th and 6th working day:

=If( Today(1) = LastWorkDate(MonthStart(Today(1)), 5) or Today(1) =LastWorkDate(MonthStart(Today()), 6), ...)

You can add a list of holidays to LastWorkDate() function.

View solution in original post

5 Replies
bhupesh_gupta
Creator
Creator

Hi Nakul

You can use a EDX trigger to achieve this.

Create a VBscript which calculates the 12th Working day and use batch file to run this every day.

On the 12th working day your VBscript should trigger the EDX task in QMC.

Otherway is to create a QVW files which calculates the 12th working day and run every day from QMC , apart from 12th working day it should fail. Create a dependent task of your main application on this task and make it run on the successful execution of this task. (But drawback you will get the failure mail on othe 29/30 days of the month , as execution will pass on 12th day only)

Regards

Bhupesh

marcus_sommer
MVP & Luminary
MVP & Luminary

I could imagine the following check-routine:

WorkingDays:

load WorkingDayFlag from

MasterCalendarWithWorkingDays

where Date = date(today()) and WorkingDayFlag = 1;

if noofrows('WorkingDays') = 1 then

     // run reload

else

     // do nothing or maybe create intentionally an error to break the execution

end if

- Marcus

swuehl
MVP
MVP

To check the 5th and 6th working day:

=If( Today(1) = LastWorkDate(MonthStart(Today(1)), 5) or Today(1) =LastWorkDate(MonthStart(Today()), 6), ...)

You can add a list of holidays to LastWorkDate() function.

nakul1001
Creator II
Creator II
Author

Thx. I will update the master calendar to include workday flag in subsequent version.

hugmarcel
Specialist
Specialist

Hi

you can use this bat-Script to calculate the first working day of month and execute a job. It uses a checkfile, thus, if the first working day execution is missed due to any issue, subsequent working days will still be used to execute the job:

@echo off
setlocal
cls

REM ***********************************************************
REM Execute Job if on first working day of month
REM ***********************************************************

REM 1.) Get day number of month (0-31)
for /f "tokens=2 delims==" %%a in ('wmic path win32_localtime get day /value') do set DOM=%%a

REM 2.) Get day number of week (0-7)
for /f "tokens=2 delims==" %%a in ('wmic path win32_localtime get dayofweek /value') do set DOW=%%a
if "%DOW%" EQU "0" set DOW=7

REM 3.) Get MonthYear (01yyyy - 12yyyy)
for /f "tokens=1-3 delims=/. " %%a in ('date /t') do set mmyyyy=%%b%%c

REM 4.) Execute Job if not yet done on an earlier working day of current month
if "%DOW%" LSS "6" IF "%DOM%" LSS "8" IF Not Exist %mmyyyy%.txt (
  echo First Working Day of Month Job executed.
  echo Day Of Month: %DOM%; Day Of Week: %DOW%; MMYYYY: %mmyyyy%
  Echo "Month %mmyyyy% done" > %mmyyyy%.txt
)

REM 5.) Exit if control file already exists
IF Exist %mmyyyy%.txt GOTO END

:END