<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic problem using variable for holidays in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/problem-using-variable-for-holidays-in-script/m-p/204604#M61432</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;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';&lt;BR /&gt;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)';&lt;BR /&gt;&lt;BR /&gt;if(LOG_CNT=1,&lt;BR /&gt; 'begin',&lt;BR /&gt; if(TRAY_NO=peek(TRAY_NO),&lt;BR /&gt; (networkdays(peek(AMD_DATE),AMD_DATE)-networkdays(peek(AMD_DATE),AMD_DATE,$(Holidays))),&lt;BR /&gt; 'pb'&lt;BR /&gt; )&lt;BR /&gt; ) as holidays_between,&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Apr 2010 01:54:40 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-04-07T01:54:40Z</dc:date>
    <item>
      <title>problem using variable for holidays in script</title>
      <link>https://community.qlik.com/t5/QlikView/problem-using-variable-for-holidays-in-script/m-p/204604#M61432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;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';&lt;BR /&gt;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)';&lt;BR /&gt;&lt;BR /&gt;if(LOG_CNT=1,&lt;BR /&gt; 'begin',&lt;BR /&gt; if(TRAY_NO=peek(TRAY_NO),&lt;BR /&gt; (networkdays(peek(AMD_DATE),AMD_DATE)-networkdays(peek(AMD_DATE),AMD_DATE,$(Holidays))),&lt;BR /&gt; 'pb'&lt;BR /&gt; )&lt;BR /&gt; ) as holidays_between,&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Apr 2010 01:54:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-using-variable-for-holidays-in-script/m-p/204604#M61432</guid>
      <dc:creator />
      <dc:date>2010-04-07T01:54:40Z</dc:date>
    </item>
  </channel>
</rss>

