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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load holiday list into variable in script

Hi,

in order to use the below function I would like to load a list of holidays into a variable.

FirstWorkDate(Today(), 1, $(vMyHolidays))

Im stuck.

Any ideas?

Attaching example data and QV-doc.

//O

12 Replies
NareshGuntur
Partner - Specialist
Partner - Specialist

Olle,

If you are trying to get the start days for all the holidays, you should be using a for loop so that all the holiday values will be included. If this is not clear, please explain more about the final output you are interested in.

Best Regards,

Naresh

tresesco
MVP
MVP

Try defining your variable like:

=Chr(39)&Concat(Holidays,chr(39)&','&chr(39))&chr(39)

In the fornt-end

NareshGuntur
Partner - Specialist
Partner - Specialist

Add this in the script

set vMyHolidays = "max(Holiday)";

where Holiday is the name of the field which contains the list of holidays.

Best Regards,

Naresh

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this expression

=FirstWorkDate(Today(), 1, Chr(39) & Concat(Holidays, Chr(39)&','&Chr(39))&Chr(39))

Regards,

Jagan.

Anonymous
Not applicable
Author

try loading your master calendar like this :

//******* Holiday********

tblHoliday:

LOAD Date(Holiday) as Holiday;

SQL SELECT Holiday

FROM table1;

/************** varHoliday **************/

tmpTbl:

NoConcatenate

LOAD Concat(Holiday,',') as fieldHoliday

Resident tblHoliday;

LET varHoliday = Peek('fieldHoliday',0,'tmpTbl');

DROP Table tmpTbl;

//Script One

Let varMinDate = num(MakeDate(2000,1,1));

Let varMaxDate = num(MakeDate(2020,12,31));

//*************** Temporary Calendar ***************

TempCalendar:

LOAD

  $(varMinDate) + rowno() - 1 AS Num,

  date($(varMinDate) + rowno() - 1) AS TempDate

AUTOGENERATE

  $(varMaxDate) - $(varMinDate) + 1;

//*************** Master Calendar ***************

MasterCalendar:

LOAD TempDate AS CalDate,

  Date(TempDate) AS CalanderDate,

  If(weekday(TempDate)='Sat' or weekday(TempDate)='Sun' or If(substringcount('$(varHoliday)',Date(TempDate))>0,1,0),0,1) as HolidayFlag

  1 As PlannedBD,

..

..

..

..

resident TempCalendar

ORDER BY TempDate ASC;

then use holidayflag to check if it is holiday or not in your calculation.

Not applicable
Author

Capture.JPG@Jagan and Naresh,

tried to implement your suggested solutions but holidays are still not calculated for

For instance, for "Date"m 2-jan, prev date should be 30-Dec

Not applicable
Author

Hi balkumarchandel.

Im calling an add in kind of master calendar for all of my apps so your solution is not appropriate for me im afraid.

Thanks though!

NareshGuntur
Partner - Specialist
Partner - Specialist

For Date 02-Jan-15, there's no holiday associated. So, it doesn't consider 01-Jan-15 as a holiday

Cheers,

Naresh

Not applicable
Author

Sorry, my bad!

Now it should be updated accordingly.

But still no change as far as I can see.

Regards,

Olle