<?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 Re: using an if statement inside  'where' in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424242#M698355</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make sure you terminate the SET statements with a semi-colon as in my example earlier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Feb 2013 13:02:41 GMT</pubDate>
    <dc:creator>flipside</dc:creator>
    <dc:date>2013-02-11T13:02:41Z</dc:date>
    <item>
      <title>using an if statement inside  'where'</title>
      <link>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424236#M698349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI i need a little help here. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically I have a variable called &lt;EM&gt;owner&lt;/EM&gt; and I want to use this inside a where clause, however I only want to include this if there is something inside the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the minute I am using this which is including it regardless of whether there is anything inside &lt;EM&gt;owner &lt;/EM&gt;or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM REP_TASK_NF WHERE CANCELLED_DATE = '' AND OWNER = '$(owner)'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need it to only use owner if it IS NOT NULL, how do i do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 12:02:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424236#M698349</guid>
      <dc:creator />
      <dc:date>2013-02-11T12:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: using an if statement inside  'where'</title>
      <link>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424237#M698350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may check OWNER or $(owner) so if you add the condition "AND NOT OWNER is null" or if you are loading data with LOAD : "AND not isnull($(owner))"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let me know&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 12:20:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424237#M698350</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2013-02-11T12:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: using an if statement inside  'where'</title>
      <link>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424238#M698351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;FROM REP_TASK_NF WHERE CANCELLED_DATE = '' AND OWNER = '$(owner)'&lt;/SPAN&gt; &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;AND NOT OWNER is null&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;Like this??&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But wont that &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;"AND NOT OWNER is null"&lt;/SPAN&gt; check to see that the column/field OWNER is empty?? or am i misunderstanding what that does?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;owner&lt;/EM&gt; is essentially a text input which you either put something in or you dont. if its full then i need to include it in the where. if not i can miss the OWNER field out in the where&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 12:29:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424238#M698351</guid>
      <dc:creator />
      <dc:date>2013-02-11T12:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: using an if statement inside  'where'</title>
      <link>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424239#M698352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try dynamic script for your where clause like this ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;let owner = 'A';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF '$(owner)' = '' or IsNull($(owner)) then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set vWhere = CANCELLED_DATE = '' AND OWNER = '$(owner)';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ELSE &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set vWhere = CANCELLED_DATE = '';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ENDIF;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... and call the where clause as &lt;STRONG&gt;... resident Data where $(vWhere);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 12:31:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424239#M698352</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2013-02-11T12:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: using an if statement inside  'where'</title>
      <link>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424240#M698353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, if you want to test the variable after the Select use a Load and add a where condition like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where not isnull($(owner))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 12:35:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424240#M698353</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2013-02-11T12:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: using an if statement inside  'where'</title>
      <link>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424241#M698354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IF '$(owner)' = '' THEN&lt;/P&gt;&lt;P&gt;SET oWhere = AND OWNER = '$(owner)'&lt;/P&gt;&lt;P&gt;ELSE&lt;/P&gt;&lt;P&gt;SET oWhere = ''&lt;/P&gt;&lt;P&gt;ENDIF;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL SELECT CANCELLED_DATE,CLOSED_DATE,CLOSED_TIME,DEADLINE_DATE,DEADLINE_TIME,DOCUMENT_TYPE,TASK_FAULT_CODE_ID,TASK_ID,TASK_TYPE,X_OPEN,OWNER&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM REP_TASK_NF &lt;/P&gt;&lt;P&gt;WHERE CANCELLED_DATE = '' &lt;/P&gt;&lt;P&gt;$(oWhere)&lt;/P&gt;&lt;P&gt;AND DOCUMENT_TYPE = '$(documentType)' &lt;/P&gt;&lt;P&gt;AND DEADLINE_DATE &amp;lt;&amp;gt; '' &lt;/P&gt;&lt;P&gt;AND DEADLINE_DATE &amp;gt;= '$(FromDate)';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've used this and even though theres something in $(owner) i have no results &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 12:42:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424241#M698354</guid>
      <dc:creator />
      <dc:date>2013-02-11T12:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: using an if statement inside  'where'</title>
      <link>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424242#M698355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make sure you terminate the SET statements with a semi-colon as in my example earlier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 13:02:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424242#M698355</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2013-02-11T13:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: using an if statement inside  'where'</title>
      <link>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424243#M698356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also helps if I give you the code the right way round &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/blush.png" /&gt; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF '$(owner)' = '' THEN&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET oWhere = '';&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ELSE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET oWhere = AND OWNER = '$(owner)';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ENDIF;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 13:08:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424243#M698356</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2013-02-11T13:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: using an if statement inside  'where'</title>
      <link>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424244#M698357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yea i just noticed those. &lt;/P&gt;&lt;P&gt;Thats working good now. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One more thing though, I have 2 fields like this. is there a way of concatinating these onto the end of the where if their is data in one of or both of these variables? instead of writing out the long where for each one. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 13:09:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424244#M698357</guid>
      <dc:creator />
      <dc:date>2013-02-11T13:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: using an if statement inside  'where'</title>
      <link>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424245#M698358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could either build them into your IF statement or append field filters to your oWhere variable ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF '$(owner)' = '' THEN&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET oWhere = '';&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ELSE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET oWhere = AND OWNER = '$(owner)';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ENDIF;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF '$(documentType)' = '' THEN&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET oWhere = '$(oWhere)';&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ELSE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET oWhere = $(oWhere) AND DOCUMENT_TYPE = '$(documentType)';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ENDIF;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 13:18:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424245#M698358</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2013-02-11T13:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: using an if statement inside  'where'</title>
      <link>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424246#M698359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That all works ok. Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 15:13:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-an-if-statement-inside-where/m-p/424246#M698359</guid>
      <dc:creator />
      <dc:date>2013-02-11T15:13:52Z</dc:date>
    </item>
  </channel>
</rss>

