<?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: if condition in qlikview script where clause in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042220#M642159</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think, its already been answered by &lt;A _jive_internal="true" href="https://community.qlik.com/people/TamilArasu"&gt;Tamil Nagaraj&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and&amp;nbsp; Sinan Ozdemir.&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try their solution and close this thread, if you have got the answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jan 2016 06:45:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-01-21T06:45:46Z</dc:date>
    <item>
      <title>if condition in qlikview script where clause</title>
      <link>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042217#M642156</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;In my script i want to declare and run the where clause according to some filter condition and criteria is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if weekday=Monday Then &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load&amp;nbsp; ID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&lt;/P&gt;&lt;P&gt;Where publish_start_date &amp;lt;= Today()-2 &lt;/P&gt;&lt;P&gt;and&amp;nbsp; &lt;SPAN style="font-size: 13.3333px;"&gt;publish_end_date &amp;lt;= Today();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if other day than&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Load&amp;nbsp; ID,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Where publish_start_date &amp;lt;= Today()&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;and&amp;nbsp; &lt;SPAN style="font-size: 13.3333px;"&gt;publish_end_date &amp;lt;= Today();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please suggest how can i create this statement or if possible than in one query can i create.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 03:00:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042217#M642156</guid>
      <dc:creator>qliklearnervir</dc:creator>
      <dc:date>2016-01-21T03:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: if condition in qlikview script where clause</title>
      <link>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042218#M642157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like this should help you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vWeekday = WeekDay(Today());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If '$(vWeekday)' = 'Mon' Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where publish_start_date &amp;lt;= Today()-2 and publish_end_date &amp;lt;= Today()&lt;/P&gt;&lt;P&gt;Else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where publish_start_date &amp;lt;= Today() and publish_end_date &amp;lt;= Today()&lt;/P&gt;&lt;P&gt;Endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a sample IF implementation:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/112169_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;In my example, I am only loading the data of Company A if the weekday is Wed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 03:28:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042218#M642157</guid>
      <dc:creator>sinanozdemir</dc:creator>
      <dc:date>2016-01-21T03:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: if condition in qlikview script where clause</title>
      <link>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042219#M642158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14533577681864692" jivemacro_uid="_14533577681864692" modifiedtitle="true"&gt;
&lt;P&gt;If Weekday(Today())= 'Mon' Then &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Load&amp;nbsp; ID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&lt;/P&gt;
&lt;P&gt;Where publish_start_date &amp;lt;= Date(Today()-2 , 'DD/MM/YYYY') and&amp;nbsp; publish_end_date &amp;lt;= Today();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Else&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Load&amp;nbsp; ID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&lt;/P&gt;
&lt;P&gt;Where publish_start_date &amp;lt;= Today() and&amp;nbsp; publish_end_date &amp;lt;= Today();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ENDIF&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff0000;"&gt;Note:&lt;/STRONG&gt; I assume your fields (publish_start_date, publish_end_date) date format as "DD/MM/YYYY". If not, you need format the Today() functions date format wherever it's used. ( Date(Today()), 'Your format)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 06:32:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042219#M642158</guid>
      <dc:creator>tamilarasu</dc:creator>
      <dc:date>2016-01-21T06:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: if condition in qlikview script where clause</title>
      <link>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042220#M642159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think, its already been answered by &lt;A _jive_internal="true" href="https://community.qlik.com/people/TamilArasu"&gt;Tamil Nagaraj&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and&amp;nbsp; Sinan Ozdemir.&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try their solution and close this thread, if you have got the answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 06:45:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042220#M642159</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-21T06:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: if condition in qlikview script where clause</title>
      <link>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042221#M642160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should weigh the advantage of writing shorter script code versus script code that performs better. AFAIK your original question was: &lt;EM&gt;can I embed this condition in the WHERE clause itself&lt;/EM&gt;? The answer is&amp;nbsp; yes. But you may get worse performance than when leaving the condition out of the WHERE clause. For example, this works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD * INLINE [&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ID, publish_start_date, publish_end_date&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1, 1/1/2016, 10/1/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;2, 21/1/2016, 21/1/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;3, 31/1/2016, 15/2/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;WHERE publish_start_date &amp;lt;= (Today() + (WeekDay(Today()) = 0)*2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;AND publish_end_date &amp;lt;= Today();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know much about how QlikView optimizes LOAD statements. Worst case would be that it does not, and that the WHERE clause is evaluated &lt;EM&gt;for every single row in your source table&lt;/EM&gt;. Since the calculation part never changes between rows, you would be losing precious time and energy in calculating the same result over and over.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any case, a better solution would be to move the calculation out of the LOAD statement, like in:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LET vStartDateLimit = &lt;SPAN style="font-size: 13.3333px;"&gt;(Today() + (WeekDay(Today()) = 0)*2);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD * INLINE [&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ID, publish_start_date, publish_end_date&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1, 1/1/2016, 10/1/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;2, 21/1/2016, 21/1/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;3, 31/1/2016, 15/2/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;]&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;WHERE publish_start_date &amp;lt;= $(vStartDateLimit)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;AND publish_end_date &amp;lt;= Today();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;which calculates the Monday/OtherWeekDay limit only once. Note that we still use only one LOAD statement.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;If you do not like this kind of script code compression, you can do as Balraj says and select on of the identical earlier responses. But you will have to type more text. And since your example may only reflect the issue and not necessarily the huge LOAD you are preparing, I thought it would be useful to mention this.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Best,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 08:46:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042221#M642160</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-01-21T08:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: if condition in qlikview script where clause</title>
      <link>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042222#M642161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you sure?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 08:51:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-condition-in-qlikview-script-where-clause/m-p/1042222#M642161</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-01-21T08:51:18Z</dc:date>
    </item>
  </channel>
</rss>

