<?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 Equivalent to a switch case or match with numeric comparison in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253354#M396376</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been searching for hours a solution to an old reququest :&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/ideas/2563" title="https://community.qlik.com/ideas/2563"&gt;https://community.qlik.com/ideas/2563&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In fact, I try to write a code &lt;STRONG&gt;which evaluates my variable only once&lt;/STRONG&gt; (because it consumes a lot of time), in order to avoid to evaluates it for time in each IF statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;My code is the following :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=IF(RangeMin($(vCouleurBAAA),$(vCouleurBABB),$(vCouleurBABD))&amp;gt;=0.9,ARGB(255,193,238,149),&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(RangeMin($(vCouleurBAAA),$(vCouleurBABB),$(vCouleurBABD))&amp;gt;=0.75,ARGB(255,255,255,153),&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(RangeMin($(vCouleurBAAA),$(vCouleurBABB),$(vCouleurBABD))&amp;gt;=0.5,ARGB(255,255,197,138),ARGB(255,255,119,122))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I thought of different solutions, without success. I would like to write a code like this (one evaluation of the variable).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Switch(RangeMin($(vCouleurBAAA),$(vCouleurBABB),$(vCouleurBABD)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case (&amp;gt;=0.9) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case(&amp;gt;=0.75) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case(&amp;gt;=0.50) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // etc.&lt;/P&gt;&lt;P&gt;End&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or something like a match with numeric comparison( greater than, less than etc.) in it likes :&lt;/P&gt;&lt;P&gt;match(RangeMin($(vCouleurBAAA),$(vCouleurBABB),$(vCouleurBABD)), &amp;gt;=0.9, &amp;gt;=0.75, &amp;gt;=0.5) // etc. and pick the right color&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot !! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Mar 2017 14:42:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-03-08T14:42:34Z</dc:date>
    <item>
      <title>Equivalent to a switch case or match with numeric comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253354#M396376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been searching for hours a solution to an old reququest :&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/ideas/2563" title="https://community.qlik.com/ideas/2563"&gt;https://community.qlik.com/ideas/2563&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In fact, I try to write a code &lt;STRONG&gt;which evaluates my variable only once&lt;/STRONG&gt; (because it consumes a lot of time), in order to avoid to evaluates it for time in each IF statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;My code is the following :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=IF(RangeMin($(vCouleurBAAA),$(vCouleurBABB),$(vCouleurBABD))&amp;gt;=0.9,ARGB(255,193,238,149),&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(RangeMin($(vCouleurBAAA),$(vCouleurBABB),$(vCouleurBABD))&amp;gt;=0.75,ARGB(255,255,255,153),&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(RangeMin($(vCouleurBAAA),$(vCouleurBABB),$(vCouleurBABD))&amp;gt;=0.5,ARGB(255,255,197,138),ARGB(255,255,119,122))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I thought of different solutions, without success. I would like to write a code like this (one evaluation of the variable).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Switch(RangeMin($(vCouleurBAAA),$(vCouleurBABB),$(vCouleurBABD)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case (&amp;gt;=0.9) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case(&amp;gt;=0.75) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case(&amp;gt;=0.50) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // etc.&lt;/P&gt;&lt;P&gt;End&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or something like a match with numeric comparison( greater than, less than etc.) in it likes :&lt;/P&gt;&lt;P&gt;match(RangeMin($(vCouleurBAAA),$(vCouleurBABB),$(vCouleurBABD)), &amp;gt;=0.9, &amp;gt;=0.75, &amp;gt;=0.5) // etc. and pick the right color&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot !! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Mar 2017 14:42:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253354#M396376</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-08T14:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent to a switch case or match with numeric comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253355#M396377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be check here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/ScriptControlStatements/Switch.htm" title="https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/ScriptControlStatements/Switch.htm"&gt;https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/ScriptControlStatements/Switch.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Mar 2017 18:03:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253355#M396377</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2017-03-08T18:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent to a switch case or match with numeric comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253356#M396378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Switch/Case is available only in script, not chart expressions. There are several solutions to the multi evaluation problem in a chart, depending on context.&amp;nbsp; I take it this is a background color expression in a chart?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the expression:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;RangeMin($(vCouleurBAAA),$(vCouleurBABB),$(vCouleurBABD))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;is already being calculated in the chart, then refer to the expression label or the column() in your expression. For example, if this expression is in a column named "Sales" make your background color expression like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;if(Sales&amp;gt;0.9, etc...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;If the expression is not already being calculated in the chart, add it is as hidden column in the chart and again refer to the label in the color expression. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://masterssummit.com" rel="nofollow" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com" rel="nofollow" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Mar 2017 18:22:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253356#M396378</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2017-03-08T18:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent to a switch case or match with numeric comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253357#M396379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello ! Thanks for yours answers guys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vishwarath, I need to use a "switch like" statement in my expression, not in my load script, but thanks &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob, my expression is evaluated on the fly (not in a chart) and a lot of these expression are evaluated too. Something like 15 expressions are evaluated on the fly, in order to color buttons. These colors represent a level of risk in the app.&lt;/P&gt;&lt;P&gt;Because of the number of buttons, I can't create a hidden field for each, it's seems dirty to me and not very m&lt;SPAN lang="en"&gt;aintainable.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's to bad that switch/case aren't available in chart expressions.&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/confused.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Mar 2017 14:08:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253357#M396379</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-09T14:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent to a switch case or match with numeric comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253358#M396380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don't need to evaluate in a chart, you can define it and evaluate it once in a variable with "=". for example, create a variable named vMyExpr and define the contents as:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'courier new', courier;"&gt;=RangeMin($(vCouleurBAAA),$(vCouleurBABB),$(vCouleurBABD))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;This effectively makes references to vMyExpr a constant. &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Then your button color expression will be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if(vMyExpr&amp;gt;0.5, ..&lt;/SPAN&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://masterssummit.com/" rel="nofollow" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com/" rel="nofollow" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Mar 2017 16:48:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253358#M396380</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2017-03-09T16:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent to a switch case or match with numeric comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253359#M396381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like I said before, I have a lot of variable with a RangeMin(...) in it (like different variable). So I have to double my number of variable (with expression in it). I think it's not an optimal way beacause the qlikview app will be harder to maintain, but I have no other solution for now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your expertise &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Mar 2017 08:53:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Equivalent-to-a-switch-case-or-match-with-numeric-comparison/m-p/1253359#M396381</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-10T08:53:35Z</dc:date>
    </item>
  </channel>
</rss>

