<?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: Use logical functions in loadscript in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313921#M115879</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hm, what is so bad using a single if per group by value? Using sum should be pretty efficient also.&lt;/P&gt;&lt;P&gt;Haven't done any testings on this, but I can't really believe that this should perform so much worse than using (if that would exist) a Product function on a result got from a subtraction (1-Condition). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe I am wrong here, would need to test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit:&lt;/P&gt;&lt;P&gt;Just tested with 10 Million Input rows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using two loads / where clause:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 59 s&lt;/P&gt;&lt;P&gt;using Max function and group by&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72 s&lt;/P&gt;&lt;P&gt;using if(sum(Condition),1,0) / group by&amp;nbsp; 70 s&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Feb 2012 15:57:40 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2012-02-23T15:57:40Z</dc:date>
    <item>
      <title>Use logical functions in loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313915#M115873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We need to use the logical OR function in the load script: if any condition is TRUE, then Any_Condition is TRUE as well:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INPUT&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" height="167" style="border: 1px solid #000000; width: 232px; text-align: center;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Time&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Condition&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OUTPUT&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" height="167" style="border: 1px solid #000000; width: 232px; text-align: center;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Time&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Any_Condition&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So basically we could write like: &lt;SPAN style="color: #008000;"&gt;if(sum(Condition)&amp;gt;0,1) group by Time&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;But for reasons of performance, we cannot use if statements. and this is why we should use an OR:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt; 1-Product(1-Condition) group by Time&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;But there is no Prooduct function. How can we get what we want?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Cheers, Jonas&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 14:15:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313915#M115873</guid>
      <dc:creator />
      <dc:date>2012-02-23T14:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Use logical functions in loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313916#M115874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you sure this would perform better that the sum with an if() ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not answer your orignal request, but maybe this would work and perform well enough:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you could try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;INPUT:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD Time as InputTime, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Condition&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/thread/47967?tstart=0"&gt;http://community.qlik.com/thread/47967?tstart=0&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(html, codepage is 1252, embedded labels, table is @1);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;OUTPUT:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD distinct InputTime as Time, 1 as Any_Condition&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident INPUT where Condition = 1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD InputTime as Time, 0 as Any_Condition&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident INPUT where Condition = 0 and not Exists(Time, InputTime);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit:&lt;/P&gt;&lt;P&gt;removed typo&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 14:48:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313916#M115874</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-23T14:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Use logical functions in loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313917#M115875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, maybe also possible:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INPUT:&lt;/P&gt;&lt;P&gt;LOAD Time, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Condition&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://community.qlik.com/thread/47967?tstart=0"&gt;http://community.qlik.com/thread/47967?tstart=0&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;(html, codepage is 1252, embedded labels, table is @1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OUTPUT:&lt;/P&gt;&lt;P&gt;LOAD Time, max(Condition) as Any_Condition&lt;/P&gt;&lt;P&gt;Resident INPUT group by Time;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 14:57:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313917#M115875</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-23T14:57:48Z</dc:date>
    </item>
    <item>
      <title>Use logical functions in loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313918#M115876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Stefan!&lt;/P&gt;&lt;P&gt;Okay, but there may be an infinite number of concurrent conditions.&lt;/P&gt;&lt;P&gt;Then your way does no longer work, does it?&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Jonas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 15:08:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313918#M115876</guid>
      <dc:creator />
      <dc:date>2012-02-23T15:08:14Z</dc:date>
    </item>
    <item>
      <title>Use logical functions in loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313919#M115877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure what your mean with 'infinite number of concurrent conditions' in terms of 'infinite' and 'concurrent'.&lt;/P&gt;&lt;P&gt;Do you mean yo have several Condition fields you need to take care of? At least the second example should be extendable quite easily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just for interest: Is your first approach using the if(sum()) really performing so bad? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 15:17:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313919#M115877</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-23T15:17:28Z</dc:date>
    </item>
    <item>
      <title>Use logical functions in loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313920#M115878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, for pointing this out, I missed your second reply.&lt;/P&gt;&lt;P&gt;MAX is indeed a possibility, right.&lt;/P&gt;&lt;P&gt;But I worry about the performance: is there no other way to make the product of Fields, or a way to perform boolean operations over several fields (AND is easy: make product of FIELD, NOTis also easy: 1-FIELD, but how to make OR)? &lt;/P&gt;&lt;P&gt;We could also use a SUM and if SUM&amp;gt;0, but this would need an IF ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 15:30:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313920#M115878</guid>
      <dc:creator />
      <dc:date>2012-02-23T15:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Use logical functions in loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313921#M115879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hm, what is so bad using a single if per group by value? Using sum should be pretty efficient also.&lt;/P&gt;&lt;P&gt;Haven't done any testings on this, but I can't really believe that this should perform so much worse than using (if that would exist) a Product function on a result got from a subtraction (1-Condition). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe I am wrong here, would need to test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit:&lt;/P&gt;&lt;P&gt;Just tested with 10 Million Input rows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using two loads / where clause:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 59 s&lt;/P&gt;&lt;P&gt;using Max function and group by&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72 s&lt;/P&gt;&lt;P&gt;using if(sum(Condition),1,0) / group by&amp;nbsp; 70 s&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 15:57:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-logical-functions-in-loadscript/m-p/313921#M115879</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-23T15:57:40Z</dc:date>
    </item>
  </channel>
</rss>

