<?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: How to reduce multiple if condition in script editor in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-reduce-multiple-if-condition-in-script-editor/m-p/1188226#M887082</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe these approaches give you some alternative ideas:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace(Replace(Range,'$',''),'&amp;amp;','-') as Range_num&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pick(Match(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Ratio,&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;'20% &amp;amp; Under',&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;'22.5%',&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;'25.0%'),&amp;nbsp;&amp;nbsp; // add your other cases in analog way&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'0-20',&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;'20.1-22.5',&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;'22.6-25.0'&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;) as Range_ration&amp;nbsp; &lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Or use a MAPPING table approach:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/4267"&gt;Data Cleansing&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Sep 2016 17:45:43 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2016-09-20T17:45:43Z</dc:date>
    <item>
      <title>How to reduce multiple if condition in script editor</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-reduce-multiple-if-condition-in-script-editor/m-p/1188225#M887081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am loading data from a table in the script editor , and in that table i have multiple if conditions, below is the code that i am using.&lt;/P&gt;&lt;P&gt;Could you please help me on how to reduce multiple if condition . However my below code works , but i personally do not like multiple if conditions. &lt;/P&gt;&lt;P&gt;Please share your thoughts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table2:&lt;/P&gt;&lt;P&gt;load&amp;nbsp; Range,&lt;/P&gt;&lt;P&gt;Data,&lt;/P&gt;&lt;P&gt;Ratio,&lt;/P&gt;&lt;P&gt;if(Range= '$350&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;$499', '350-499' ,if(Range= '$500&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;$749','500-749' ,if( Range='$750&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;$999','750-999',if(Range ='$1000&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;$1249','1000-1249',if(Range ='$1250&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;$1499' , '1250-1499',if(Range='$1500&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;$1749','1500-1749',if(Range='$1750&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;$1999','1750-1999',if(Range='$2000&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;$2499','2000-2499',if(Range='$2500&lt;/P&gt;&lt;P&gt;&amp;amp;&lt;/P&gt;&lt;P&gt;Up', '2500-Up'))))))))) as Range_num,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(Ratio= '20% &amp;amp; Under','0-20',if(Ratio='22.5%',&lt;/P&gt;&lt;P&gt;'20.1-22.5',if(Ratio='25.0%','22.6-25.0',&lt;/P&gt;&lt;P&gt;if(Ratio='27.0%','25.1-27.0',if(Ratio='29.0%','27.1-29.0',&lt;/P&gt;&lt;P&gt;if(Ratio='31.0%','29.1-31.0',if(Ratio='33.0%','31.1-33.0',&lt;/P&gt;&lt;P&gt;if(Ratio='35.0%','33.1-35.0',if(Ratio='39.0%','35.1-39.0',&lt;/P&gt;&lt;P&gt;if(Ratio='41.0%','39.1-41.0',if(Ratio='43.0%','41.1-43.0',&lt;/P&gt;&lt;P&gt;if(Ratio='45.0%','43.1-45.0',if(Ratio='47.0%','45.1-47.0',&lt;/P&gt;&lt;P&gt;if(Ratio='50.0%','47.1-50.0',if (Ratio&amp;gt;='50.0%','NA'))&lt;/P&gt;&lt;P&gt;))))))))))))) as Range_ration&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Resident Table1 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Ashis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-reduce-multiple-if-condition-in-script-editor/m-p/1188225#M887081</guid>
      <dc:creator>ashis</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to reduce multiple if condition in script editor</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-reduce-multiple-if-condition-in-script-editor/m-p/1188226#M887082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe these approaches give you some alternative ideas:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace(Replace(Range,'$',''),'&amp;amp;','-') as Range_num&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pick(Match(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Ratio,&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;'20% &amp;amp; Under',&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;'22.5%',&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;'25.0%'),&amp;nbsp;&amp;nbsp; // add your other cases in analog way&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'0-20',&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;'20.1-22.5',&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;'22.6-25.0'&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;) as Range_ration&amp;nbsp; &lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Or use a MAPPING table approach:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/4267"&gt;Data Cleansing&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 17:45:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-reduce-multiple-if-condition-in-script-editor/m-p/1188226#M887082</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-09-20T17:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to reduce multiple if condition in script editor</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-reduce-multiple-if-condition-in-script-editor/m-p/1188227#M887083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you aware of internal document match. Hope that help you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 18:04:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-reduce-multiple-if-condition-in-script-editor/m-p/1188227#M887083</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2016-09-20T18:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to reduce multiple if condition in script editor</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-reduce-multiple-if-condition-in-script-editor/m-p/1188228#M887084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Stefan for your help. It worked for the 1st part,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have replaced the 2nd nested if conditions with the following code, however it is only picking the '&lt;SPAN style="font-size: 13.3333px;"&gt;20% &amp;amp; Under' value and for rest it is showing null . I am not sure if i am making any syntax error. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pick(Match(Ratio,'20% &amp;amp; Under','22.5%','25.0%','27.0%','29.0%','31.0%','33.0%','35.0%','39.0%','41.0%','43.0%','45.0%','47.0%','50.0%'), &lt;/P&gt;&lt;P&gt;'0-20',&lt;/P&gt;&lt;P&gt;'20.1-22.5',&lt;/P&gt;&lt;P&gt;'22.6-25.0',&lt;/P&gt;&lt;P&gt;'25.1-27.0',&lt;/P&gt;&lt;P&gt;'27.1-29.0',&lt;/P&gt;&lt;P&gt;'29.1-31.0',&lt;/P&gt;&lt;P&gt;'31.1-33.0',&lt;/P&gt;&lt;P&gt;'33.1-35.0',&lt;/P&gt;&lt;P&gt;'35.1-39.0',&lt;/P&gt;&lt;P&gt;'39.1-41.0',&lt;/P&gt;&lt;P&gt;'41.1-43.0','43.1-45.0','45.1-47.0','47.1-50.0'&lt;/P&gt;&lt;P&gt;) as Range_ration&lt;/P&gt;&lt;P&gt;Resident Table1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2016 08:40:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-reduce-multiple-if-condition-in-script-editor/m-p/1188228#M887084</guid>
      <dc:creator>ashis</dc:creator>
      <dc:date>2016-09-22T08:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to reduce multiple if condition in script editor</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-reduce-multiple-if-condition-in-script-editor/m-p/1188229#M887085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Seems to work just fine. Probably your input values don't match exactely. What is the source of your data?&lt;/P&gt;&lt;P&gt;Could you post some sample records (excel file, QVD, etc)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;Pick(Match(Ratio,'20% &amp;amp; Under','22.5%','25.0%','27.0%','29.0%','31.0%','33.0%','35.0%','39.0%','41.0%','43.0%','45.0%','47.0%','50.0%'),&lt;/P&gt;&lt;P&gt;'0-20',&lt;/P&gt;&lt;P&gt;'20.1-22.5',&lt;/P&gt;&lt;P&gt;'22.6-25.0',&lt;/P&gt;&lt;P&gt;'25.1-27.0',&lt;/P&gt;&lt;P&gt;'27.1-29.0',&lt;/P&gt;&lt;P&gt;'29.1-31.0',&lt;/P&gt;&lt;P&gt;'31.1-33.0',&lt;/P&gt;&lt;P&gt;'33.1-35.0',&lt;/P&gt;&lt;P&gt;'35.1-39.0',&lt;/P&gt;&lt;P&gt;'39.1-41.0',&lt;/P&gt;&lt;P&gt;'41.1-43.0','43.1-45.0','45.1-47.0','47.1-50.0'&lt;/P&gt;&lt;P&gt;) as Range_ration&lt;/P&gt;&lt;P&gt;INLINE [&lt;/P&gt;&lt;P&gt;Ratio&lt;/P&gt;&lt;P&gt;'20% &amp;amp; Under'&lt;/P&gt;&lt;P&gt;'22.5%'&lt;/P&gt;&lt;P&gt;'25.0%'&lt;/P&gt;&lt;P&gt;'27.0%'&lt;/P&gt;&lt;P&gt;'29.0%'&lt;/P&gt;&lt;P&gt;'31.0%'&lt;/P&gt;&lt;P&gt;'33.0%'&lt;/P&gt;&lt;P&gt;'35.0%'&lt;/P&gt;&lt;P&gt;'39.0%'&lt;/P&gt;&lt;P&gt;'41.0%'&lt;/P&gt;&lt;P&gt;'43.0%'&lt;/P&gt;&lt;P&gt;'45.0%'&lt;/P&gt;&lt;P&gt;'47.0%'&lt;/P&gt;&lt;P&gt;'50.0%'&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2016 17:27:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-reduce-multiple-if-condition-in-script-editor/m-p/1188229#M887085</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-09-22T17:27:40Z</dc:date>
    </item>
  </channel>
</rss>

