Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

problem using variable for holidays in script

Hi everyone,

In script, I want to store my holidays in a variable, but I have some problem to use it in networkdays function. I try to calculate the number of holidays between 2 dates. Here is my script:


SET Holidays='5/10/2009, 25/12/2009, 26/12/2009, 1/01/2010, 26/01/2010, 2/04/2010, 5/04/2010, 26/04/2010, 14/06/2010, 4/10/2010, 27/12/2010, 26/01/2011';
SET Holidays_script='Chr(39) 5/10/2009 Chr(39),Chr(39) 25/12/2009 Chr(39),Chr(39) 26/12/2009 Chr(39),Chr(39) 1/01/2010 Chr(39),Chr(39) 26/01/2010 Chr(39),Chr(39) 2/04/2010 Chr(39),Chr(39) 5/04/2010 Chr(39),Chr(39) 26/04/2010 Chr(39),Chr(39) 14/06/2010 Chr(39),Chr(39) 4/10/2010 Chr(39),Chr(39) 27/12/2010 Chr(39),Chr(39) 26/01/2011 Chr(39)';

if(LOG_CNT=1,
'begin',
if(TRAY_NO=peek(TRAY_NO),
(networkdays(peek(AMD_DATE),AMD_DATE)-networkdays(peek(AMD_DATE),AMD_DATE,$(Holidays))),
'pb'
)
) as holidays_between,


When I try $(Holidays), I have only begin, pb and 0 values, so it's not working properly because between some dates I have holidays between.. When I try the formula with $(Holidays_script), I have an error message: ")" expected, but I don't know where it comes from. Does anyone have an idea for the good syntax?

Thank you for your help.

0 Replies