<?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: Optimize this If-statement for performance in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Optimize-this-If-statement-for-performance/m-p/46251#M7705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;SPAN style="color: #000000; font-family: courier new, courier;"&gt;&lt;SPAN style="color: #0000ff;"&gt;Sum&lt;/SPAN&gt; ( {&amp;lt;S&lt;SPAN style="color: #993366;"&gt;easonCalc = {"$(&lt;/SPAN&gt;&lt;SPAN style="color: #999999;"&gt;&lt;EM&gt;vCurrentSeasonCalc&lt;/EM&gt;&lt;/SPAN&gt;)"} &amp;gt;} &lt;SPAN style="color: #993366;"&gt;Fsgantal&lt;/SPAN&gt;*&lt;SPAN style="color: #993366;"&gt;_DateLastWeekAndBefore&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Feb 2018 09:39:21 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2018-02-19T09:39:21Z</dc:date>
    <item>
      <title>Optimize this If-statement for performance</title>
      <link>https://community.qlik.com/t5/QlikView/Optimize-this-If-statement-for-performance/m-p/46250#M7704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In our application we have different seasons:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="100" style="border: 1px solid rgb(0, 0, 0); width: 198px; height: 85px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;171S&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;First season in 2017&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;172S&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Second season in 2017&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;181S&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;First season in 2018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;182S&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Second season in 2018&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;etc....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to have the application change the actual season for us, we have implemented the following IF-statement in our expressions where needed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #000000; font-family: courier\ new, courier;"&gt;&lt;SPAN style="color: #0000ff;"&gt;If&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;WildMatch&lt;/SPAN&gt;(&lt;SPAN style="color: #993366;"&gt;SeasonCalc&lt;/SPAN&gt;, &lt;EM style="color: #999999;"&gt;vCurrentSeasonCalc&lt;/EM&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This expressions is also accompanied by this line in our script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #000000; font-family: courier\ new, courier;"&gt;&lt;SPAN style="color: #0000ff;"&gt;LET&lt;/SPAN&gt; &lt;SPAN style="color: #999999;"&gt;&lt;EM&gt;vCurrentSeasonCalc&lt;/EM&gt;&lt;/SPAN&gt; = &lt;SPAN style="color: #0000ff;"&gt;Right&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;Year&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;Today&lt;/SPAN&gt;()-7), 2) &amp;amp; &lt;SPAN style="color: #0000ff;"&gt;IF&lt;/SPAN&gt;(&lt;SPAN style="color: #993366;"&gt;VECKANRTMP&lt;/SPAN&gt; &amp;lt; '27','1','2') &amp;amp; '*';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;together they create a Season selecting in the expressions where we implement it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's how an expression can look like with the If-statement included:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #000000; font-family: courier\ new, courier;"&gt;&lt;SPAN style="color: #0000ff;"&gt;Sum&lt;/SPAN&gt; ( &lt;SPAN style="color: #0000ff;"&gt;If(WildMatch&lt;/SPAN&gt;(&lt;SPAN style="color: #993366;"&gt;SeasonCalc&lt;/SPAN&gt;, &lt;SPAN style="color: #999999;"&gt;&lt;EM&gt;vCurrentSeasonCalc&lt;/EM&gt;&lt;/SPAN&gt;),&lt;SPAN style="color: #993366;"&gt;Fsgantal&lt;/SPAN&gt;*&lt;SPAN style="color: #993366;"&gt;_DateLastWeekAndBefore&lt;/SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I've tried to move away from the If statement and create a more performance-friendly expression. Preferably a Set-expression. Is it even possible? I can't seem to figure out a way..&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2018 09:30:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimize-this-If-statement-for-performance/m-p/46250#M7704</guid>
      <dc:creator>robinwiman</dc:creator>
      <dc:date>2018-02-19T09:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize this If-statement for performance</title>
      <link>https://community.qlik.com/t5/QlikView/Optimize-this-If-statement-for-performance/m-p/46251#M7705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;SPAN style="color: #000000; font-family: courier new, courier;"&gt;&lt;SPAN style="color: #0000ff;"&gt;Sum&lt;/SPAN&gt; ( {&amp;lt;S&lt;SPAN style="color: #993366;"&gt;easonCalc = {"$(&lt;/SPAN&gt;&lt;SPAN style="color: #999999;"&gt;&lt;EM&gt;vCurrentSeasonCalc&lt;/EM&gt;&lt;/SPAN&gt;)"} &amp;gt;} &lt;SPAN style="color: #993366;"&gt;Fsgantal&lt;/SPAN&gt;*&lt;SPAN style="color: #993366;"&gt;_DateLastWeekAndBefore&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2018 09:39:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimize-this-If-statement-for-performance/m-p/46251#M7705</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2018-02-19T09:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize this If-statement for performance</title>
      <link>https://community.qlik.com/t5/QlikView/Optimize-this-If-statement-for-performance/m-p/46252#M7706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried this in a table and it seems like it's working. The data output is the same as if I did filter it or use the IF-statement with the wildmatch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Changing from the If-statement to the set-expression as you've explained, does mean I have to change over a 100 tables. Is there any other way I can double check that it will work in every aspect, since I'd like to find out sooner rather than later &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2018 10:04:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimize-this-If-statement-for-performance/m-p/46252#M7706</guid>
      <dc:creator>robinwiman</dc:creator>
      <dc:date>2018-02-19T10:04:45Z</dc:date>
    </item>
  </channel>
</rss>

