<?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 If then else SYNTAX in scripts in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/If-then-else-SYNTAX-in-scripts/m-p/424335#M158104</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to something I think is simple; once again, the lack of useful documentation is tripping me up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have default dates set to load a document:&lt;/P&gt;&lt;P&gt;StartDate = MonthStart(today(),-1)&lt;/P&gt;&lt;P&gt;EndDate = MonthEnd(today(),-1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These are fine for 90% of the time, but occasionally users want to run reports over different time periods. So, I tried this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;IF&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 10pt;"&gt;$(vUserSetDates)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ff8040; font-size: 10pt;"&gt;THEN&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0080ff; font-size: 10pt;"&gt;Let&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 10pt;"&gt;StartDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #004080; font-size: 10pt;"&gt;Input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;('Enter Start Date (MM/DD/YYYY)', 'Input required');&lt;BR /&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0080ff; font-size: 10pt;"&gt;Let&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 10pt;"&gt;EndDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #004080; font-size: 10pt;"&gt;Input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;('Enter End Date (MM/DD/YYYY)', 'Input required');&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0080ff; font-size: 10pt;"&gt;ELSE&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0080ff; font-size: 10pt;"&gt;Let&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 10pt;"&gt;StartDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #004080; font-size: 10pt;"&gt;MonthStart&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #004080; font-size: 10pt;"&gt;Today&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(),-1);&lt;BR /&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0080ff; font-size: 10pt;"&gt;Let&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 10pt;"&gt;EndDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #004080; font-size: 10pt;"&gt;MonthEnd&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #004080; font-size: 10pt;"&gt;Today&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(),-1);&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0080ff; font-size: 10pt;"&gt;END&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ff8040; font-size: 10pt;"&gt;IF &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;where vUserSetDates is set to either "TRUE" or "FALSE" by a button on the sheet. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;However, regardless of what vUserSetDates is, I get an error message, the input boxes ask me for start and end dates,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;and then the dates are reset to the defaults anyway. In other words, all the commands execute and the "IF" structure is ignored. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;According to the documentation, this is the correct way to structure an IF THEN ELSE statement. What am I missing?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;Thanks in advance for your help. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Oct 2012 16:03:55 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-10-17T16:03:55Z</dc:date>
    <item>
      <title>If then else SYNTAX in scripts</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-else-SYNTAX-in-scripts/m-p/424335#M158104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to something I think is simple; once again, the lack of useful documentation is tripping me up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have default dates set to load a document:&lt;/P&gt;&lt;P&gt;StartDate = MonthStart(today(),-1)&lt;/P&gt;&lt;P&gt;EndDate = MonthEnd(today(),-1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These are fine for 90% of the time, but occasionally users want to run reports over different time periods. So, I tried this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;IF&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 10pt;"&gt;$(vUserSetDates)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ff8040; font-size: 10pt;"&gt;THEN&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0080ff; font-size: 10pt;"&gt;Let&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 10pt;"&gt;StartDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #004080; font-size: 10pt;"&gt;Input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;('Enter Start Date (MM/DD/YYYY)', 'Input required');&lt;BR /&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0080ff; font-size: 10pt;"&gt;Let&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 10pt;"&gt;EndDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #004080; font-size: 10pt;"&gt;Input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;('Enter End Date (MM/DD/YYYY)', 'Input required');&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0080ff; font-size: 10pt;"&gt;ELSE&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0080ff; font-size: 10pt;"&gt;Let&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 10pt;"&gt;StartDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #004080; font-size: 10pt;"&gt;MonthStart&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #004080; font-size: 10pt;"&gt;Today&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(),-1);&lt;BR /&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0080ff; font-size: 10pt;"&gt;Let&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 10pt;"&gt;EndDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #004080; font-size: 10pt;"&gt;MonthEnd&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #004080; font-size: 10pt;"&gt;Today&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(),-1);&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0080ff; font-size: 10pt;"&gt;END&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ff8040; font-size: 10pt;"&gt;IF &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;where vUserSetDates is set to either "TRUE" or "FALSE" by a button on the sheet. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;However, regardless of what vUserSetDates is, I get an error message, the input boxes ask me for start and end dates,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;and then the dates are reset to the defaults anyway. In other words, all the commands execute and the "IF" structure is ignored. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;According to the documentation, this is the correct way to structure an IF THEN ELSE statement. What am I missing?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;Thanks in advance for your help. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 16:03:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-else-SYNTAX-in-scripts/m-p/424335#M158104</guid>
      <dc:creator />
      <dc:date>2012-10-17T16:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: If then else SYNTAX in scripts</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-else-SYNTAX-in-scripts/m-p/424336#M158105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you assigning string values like 'TRUE' and 'FALSE' to the variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try using -1 and 0 instead, or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;IF&amp;nbsp; '&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 10pt;"&gt;$(vUserSetDates)' = 'TRUE'&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ff8040; font-size: 10pt;"&gt;THEN&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff8040; font-size: 10pt;"&gt;...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 16:13:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-else-SYNTAX-in-scripts/m-p/424336#M158105</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-10-17T16:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: If then else SYNTAX in scripts</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-else-SYNTAX-in-scripts/m-p/424337#M158106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks my friend, that did the trick. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 16:21:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-else-SYNTAX-in-scripts/m-p/424337#M158106</guid>
      <dc:creator />
      <dc:date>2012-10-17T16:21:35Z</dc:date>
    </item>
  </channel>
</rss>

