<?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 How to use a variable within an IF Statement? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280322#M710042</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Where exactly did you&amp;nbsp; include this?&lt;/P&gt;&lt;P&gt;if it is in the same load, the EndDate field was not created.&lt;/P&gt;&lt;P&gt;If this is the case, you should include the if statement again in this line:&lt;/P&gt;&lt;P&gt;EmployeeID&amp;amp;'/'&amp;amp;StartDate&amp;amp;'/'&amp;amp;if( isnull(EndDate), $(varToday), EndDate)&amp;nbsp; as EmployeeIntervalKey&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Aug 2011 21:01:12 GMT</pubDate>
    <dc:creator>erichshiino</dc:creator>
    <dc:date>2011-08-17T21:01:12Z</dc:date>
    <item>
      <title>How to use a variable within an IF Statement?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280316#M710036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;SPAN style="Courier New&amp;amp;quot: ; color: black; font-size: 12pt; font-family: &amp;amp;quot;"&gt;I have a table with field names &lt;STRONG style="mso-bidi-font-weight: normal;"&gt;EndDate, StartDate &lt;/STRONG&gt;and &lt;STRONG style="mso-bidi-font-weight: normal;"&gt;EmployeeID. &lt;/STRONG&gt;For some of the employees there is no &lt;STRONG style="mso-bidi-font-weight: normal;"&gt;EndDate &lt;/STRONG&gt;and I would like to use &lt;STRONG style="mso-bidi-font-weight: normal;"&gt;varToday&lt;/STRONG&gt; (I created this variable) where an &lt;STRONG style="mso-bidi-font-weight: normal;"&gt;EndDate &lt;/STRONG&gt;is not present. I would like to load in my data with an IF Statement. Could any please help me with constructing this IF Statement. Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Aug 2011 19:41:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280316#M710036</guid>
      <dc:creator />
      <dc:date>2011-08-17T19:41:03Z</dc:date>
    </item>
    <item>
      <title>How to use a variable within an IF Statement?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280317#M710037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;in your load script, where you have: &lt;/P&gt;&lt;P&gt;Load EndDate, StartDate, EmployeeID&lt;/P&gt;&lt;P&gt;From ...&lt;/P&gt;&lt;P&gt;You can use (to get the system today)&lt;/P&gt;&lt;P&gt;Load if( isnull(EndDate), today(), EndDate) as EndDate,&lt;/P&gt;&lt;P&gt;StartDate, EmployeeID&lt;/P&gt;&lt;P&gt;From ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or (to use your variable)&lt;/P&gt;&lt;P&gt;Load if( isnull(EndDate), $(varToday), EndDate) as EndDate,&lt;/P&gt;&lt;P&gt;StartDate, EmployeeID&lt;/P&gt;&lt;P&gt;From ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;depending on the format you used inside varToday, the code should be:&lt;/P&gt;&lt;P&gt;Load if( isnull(EndDate), '$(varToday)', EndDate) as EndDate,&lt;/P&gt;&lt;P&gt;StartDate, EmployeeID&lt;/P&gt;&lt;P&gt;From ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Aug 2011 19:45:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280317#M710037</guid>
      <dc:creator>erichshiino</dc:creator>
      <dc:date>2011-08-17T19:45:12Z</dc:date>
    </item>
    <item>
      <title>How to use a variable within an IF Statement?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280318#M710038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; if(isnull(EndDate),varToday,EndDate) as ModifiedEndDate should do the trick in your load script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Aug 2011 19:45:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280318#M710038</guid>
      <dc:creator />
      <dc:date>2011-08-17T19:45:32Z</dc:date>
    </item>
    <item>
      <title>How to use a variable within an IF Statement?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280319#M710039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thanks a lot Erich and Leonard...Have a good one!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Aug 2011 19:49:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280319#M710039</guid>
      <dc:creator />
      <dc:date>2011-08-17T19:49:43Z</dc:date>
    </item>
    <item>
      <title>How to use a variable within an IF Statement?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280320#M710040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 10pt; sans-serif&amp;amp;quot: ; font-family: &amp;amp;quot; Arial&amp;amp;quot: ; ,&amp;amp;quot: ;"&gt;Now I am facing a slight problem. With the field &lt;STRONG style="mso-bidi-font-weight: normal;"&gt;EmployeeID, EndDate &lt;/STRONG&gt;and&lt;STRONG style="mso-bidi-font-weight: normal;"&gt; StartDate &lt;/STRONG&gt;I created another field called &lt;STRONG style="mso-bidi-font-weight: normal;"&gt;EmployeeIntervalKey&lt;/STRONG&gt;, but the field &lt;STRONG style="mso-bidi-font-weight: normal;"&gt;EmployeeIntervalKey &lt;/STRONG&gt;is not incorporating the values coming from the variable &lt;STRONG style="mso-bidi-font-weight: normal;"&gt;varToday.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;SPAN style="color: #000000; font-size: 12pt; mso-spacerun: yes; font-family: &amp;amp;quot;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="font-size: 12pt; sans-serif&amp;amp;quot: ; font-family: &amp;amp;quot; Arial&amp;amp;quot: ; ,&amp;amp;quot: ;"&gt;Syntax for the field &lt;/SPAN&gt;&lt;STRONG style="mso-bidi-font-weight: normal; : ; line-height: 115%; font-size: 10pt; sans-serif&amp;amp;quot: ; font-family: &amp;amp;quot; Arial&amp;amp;quot: ; ,&amp;amp;quot: ;"&gt;EmployeeIntervalKey &lt;/STRONG&gt;&lt;SPAN style="line-height: 115%; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt;"&gt;is as following:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;&lt;SPAN style=": ; color: #000000; font-size: 9pt; sans-serif&amp;amp;quot: ; font-family: &amp;amp;quot; Arial&amp;amp;quot: ; ,&amp;amp;quot: ;"&gt;EmployeeID&amp;amp;'/'&amp;amp;StartDate&amp;amp;'/'&amp;amp;EndDate as EmployeeIntervalKey &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;SPAN style="color: #000000; font-size: 12pt; sans-serif&amp;amp;quot: ; font-family: Times New Roman; Arial&amp;amp;quot: ; ,&amp;amp;quot: ;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Aug 2011 20:39:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280320#M710040</guid>
      <dc:creator />
      <dc:date>2011-08-17T20:39:28Z</dc:date>
    </item>
    <item>
      <title>How to use a variable within an IF Statement?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280321#M710041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will need to apply the same logic on the EndDate field once more:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 9pt;"&gt;EmployeeID&amp;amp;'/'&amp;amp;StartDate&amp;amp;'/'&amp;amp;if(isnull(EndDate),today(),EndDate) as EmployeeIntervalKey &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Aug 2011 20:51:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280321#M710041</guid>
      <dc:creator />
      <dc:date>2011-08-17T20:51:31Z</dc:date>
    </item>
    <item>
      <title>How to use a variable within an IF Statement?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280322#M710042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Where exactly did you&amp;nbsp; include this?&lt;/P&gt;&lt;P&gt;if it is in the same load, the EndDate field was not created.&lt;/P&gt;&lt;P&gt;If this is the case, you should include the if statement again in this line:&lt;/P&gt;&lt;P&gt;EmployeeID&amp;amp;'/'&amp;amp;StartDate&amp;amp;'/'&amp;amp;if( isnull(EndDate), $(varToday), EndDate)&amp;nbsp; as EmployeeIntervalKey&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Aug 2011 21:01:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-within-an-IF-Statement/m-p/280322#M710042</guid>
      <dc:creator>erichshiino</dc:creator>
      <dc:date>2011-08-17T21:01:12Z</dc:date>
    </item>
  </channel>
</rss>

