<?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 statement for multiple variables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821651#M1213586</link>
    <description>&lt;P&gt;Ah! This changes everything! I was assuming that a,b,c... etc are variables, but they are fields.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In qlik, you can't apply a function to a single field, there is no equivalent of ADD or UPDATE like you get in other languages.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However there's a hand piece of functionality called mapping tables which might make this easier. Please look them up, they are really useful but in essence they are a form of temporary table with two fields- and input and an output that can be used to transform other values.&lt;/P&gt;&lt;P&gt;You can actually apply the transfrom in a function (applymap () ) or even to a list of incoming fields.&lt;/P&gt;&lt;P&gt;In your example, we would do something like this:&lt;/P&gt;&lt;P&gt;MapScoreValues:&lt;/P&gt;&lt;P&gt;MAPPING&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;In, Out&lt;/P&gt;&lt;P&gt;1,&lt;SPAN&gt;1 - Ok'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2,&lt;SPAN&gt;2- Not bad&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3,&lt;SPAN&gt;3-Bad&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;4,&lt;SPAN&gt;4-Very bad];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Map&amp;nbsp;LEF.secd_qtn_2,&amp;nbsp;LEF.secd_qtn_3,&amp;nbsp;LEF.secd_qtn_4 USING&amp;nbsp;MapScoreValues;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NewTable:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;ky_LEF,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;LEF.secd_qtn_2,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LEF.secd_qtn_3,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;LEF.secd_qtn_4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;.....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The first statement "MAPPING LOAD assigns the table as a mapping table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then, we tell qlik to apply this to the list of fields&amp;nbsp; using MAP... USING&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The last statement loads the fields - they will now be transformed as per the mapping table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does this work?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Pi&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Jul 2021 08:26:32 GMT</pubDate>
    <dc:creator>PiEye</dc:creator>
    <dc:date>2021-07-13T08:26:32Z</dc:date>
    <item>
      <title>If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1820319#M1213415</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have variable A, B, C, D. They all got values ranges from 1 to 4, and all these values have its description&lt;/P&gt;&lt;P&gt;What I would like to acheieve is to keep the var names A, B, C, D but change their labels to 1 - Ok 2- Not bad; 3-Bad, 4-Very bad&lt;/P&gt;&lt;P&gt;Yes I can do that separately for each, but its time consuming because i got plenty of these&lt;/P&gt;&lt;P&gt;I was wondering about something like (for all values but ill present for one) IF(A OR B OR C OR D = 1, 'Ok'). However it does not work because it didnt set it "AS" variable. I'd like to keep A,B,C,D names but change only value because then I have good legend, not 1-4 entries&lt;BR /&gt;&lt;BR /&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 08:26:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1820319#M1213415</guid>
      <dc:creator>QlickySense</dc:creator>
      <dc:date>2021-07-07T08:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1820619#M1213451</link>
      <description>&lt;P&gt;Is this in the script?&lt;/P&gt;&lt;P&gt;You can use three elements of script functionality to achieve this&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;A "for" loop, to loop through the variables&lt;/LI&gt;&lt;LI&gt;A dollar sign expansion, "$(...)" which turns its input into code.&lt;/LI&gt;&lt;LI&gt;"Pick" is a quick way to assign a value to an integer&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This way, we can loop through the variable names, and execute a statement with $() which turns the variables names into code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SET a=1;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;SET b=3;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;SET c=4;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;SET d=2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FOR EACH vVarName IN 'a','b','c','d'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LET [$(vVarName)]=Pick([$(vVarName)],'1 - Ok','2- Not bad','3-Bad','4-Very bad');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;NEXT&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jul 2021 08:03:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1820619#M1213451</guid>
      <dc:creator>PiEye</dc:creator>
      <dc:date>2021-07-08T08:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1820920#M1213487</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/145055"&gt;@PiEye&lt;/a&gt;&amp;nbsp;. It looks promising. I've tried to paste that in several places but none of them work - scripts goes without error but nothing has been changed&lt;BR /&gt;&lt;BR /&gt;plus I tried to change&amp;nbsp;&lt;EM&gt;FOR EACH vVarName IN &lt;STRONG&gt;'a','b','c','d'&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;with actual variables without parenthesis and it does not work as well&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 08:00:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1820920#M1213487</guid>
      <dc:creator>QlickySense</dc:creator>
      <dc:date>2021-07-09T08:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1820969#M1213503</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/145134"&gt;@QlickySense&lt;/a&gt;&amp;nbsp;Might be easier with an example as there could be a few things happening here. Can you show me what you have tried exactly? And what you have modified to - and does it work when you manually set the variables to a number?&lt;/P&gt;&lt;P&gt;Sometimes if they have a space in, it might not pick up the number too&lt;/P&gt;&lt;P&gt;Pi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 10:23:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1820969#M1213503</guid>
      <dc:creator>PiEye</dc:creator>
      <dc:date>2021-07-09T10:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821049#M1213513</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/145055"&gt;@PiEye&lt;/a&gt;&amp;nbsp;What I've initially tried was on capture, then I tried to insert it into this LEF table, but nothing succeed. Kept the way on screen, kept the way you wrote with a-d, tried several diff options&lt;BR /&gt;&lt;BR /&gt;Cant give out qvf flie because its sensitive data&lt;/P&gt;&lt;P&gt;I dnt know if what I've done makes any sense&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 13:26:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821049#M1213513</guid>
      <dc:creator>QlickySense</dc:creator>
      <dc:date>2021-07-09T13:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821089#M1213521</link>
      <description>&lt;P&gt;Is LEF a table? Does this mean that LEF.secd_qtn_7... etc are fields and not variables?&lt;/P&gt;&lt;P&gt;Pi&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 15:00:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821089#M1213521</guid>
      <dc:creator>PiEye</dc:creator>
      <dc:date>2021-07-09T15:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821388#M1213551</link>
      <description>&lt;P&gt;LEF is a table, LEF.secd_qtn_7 is a field. This has been made due to Qualify function but now I understand it created huge mess.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 10:14:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821388#M1213551</guid>
      <dc:creator>QlickySense</dc:creator>
      <dc:date>2021-07-12T10:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821624#M1213580</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SET a=1;&lt;BR /&gt;SET b=3;&lt;BR /&gt;SET c=4;&lt;BR /&gt;SET d=2;&lt;/P&gt;&lt;P&gt;FOR EACH vVarName IN secd_qtn7_2.LEF, secd_qtn7_3.LEF&lt;/P&gt;&lt;P&gt;LET [$(vVarName)]=Pick([$(vVarName)],'1 - Ok','2- Not bad','3-Bad','4-Very bad');&lt;BR /&gt;&lt;BR /&gt;doesnt work without Qualify as well &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; any suggestion?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 07:00:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821624#M1213580</guid>
      <dc:creator>QlickySense</dc:creator>
      <dc:date>2021-07-13T07:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821651#M1213586</link>
      <description>&lt;P&gt;Ah! This changes everything! I was assuming that a,b,c... etc are variables, but they are fields.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In qlik, you can't apply a function to a single field, there is no equivalent of ADD or UPDATE like you get in other languages.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However there's a hand piece of functionality called mapping tables which might make this easier. Please look them up, they are really useful but in essence they are a form of temporary table with two fields- and input and an output that can be used to transform other values.&lt;/P&gt;&lt;P&gt;You can actually apply the transfrom in a function (applymap () ) or even to a list of incoming fields.&lt;/P&gt;&lt;P&gt;In your example, we would do something like this:&lt;/P&gt;&lt;P&gt;MapScoreValues:&lt;/P&gt;&lt;P&gt;MAPPING&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;In, Out&lt;/P&gt;&lt;P&gt;1,&lt;SPAN&gt;1 - Ok'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2,&lt;SPAN&gt;2- Not bad&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3,&lt;SPAN&gt;3-Bad&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;4,&lt;SPAN&gt;4-Very bad];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Map&amp;nbsp;LEF.secd_qtn_2,&amp;nbsp;LEF.secd_qtn_3,&amp;nbsp;LEF.secd_qtn_4 USING&amp;nbsp;MapScoreValues;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NewTable:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;ky_LEF,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;LEF.secd_qtn_2,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LEF.secd_qtn_3,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;LEF.secd_qtn_4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;.....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The first statement "MAPPING LOAD assigns the table as a mapping table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then, we tell qlik to apply this to the list of fields&amp;nbsp; using MAP... USING&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The last statement loads the fields - they will now be transformed as per the mapping table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does this work?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Pi&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 08:26:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821651#M1213586</guid>
      <dc:creator>PiEye</dc:creator>
      <dc:date>2021-07-13T08:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821665#M1213587</link>
      <description>&lt;P&gt;Yess!! Thank you very much&lt;BR /&gt;Could you give some advice from which sources it is best to learn Qlik? I find it much harder to learn python/R or other languages - syntax wise as well as what certain functions do to UI/data model&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 08:53:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821665#M1213587</guid>
      <dc:creator>QlickySense</dc:creator>
      <dc:date>2021-07-13T08:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821669#M1213588</link>
      <description>&lt;P&gt;Hi, have just sent a PM - let me know if you get it!&lt;/P&gt;&lt;P&gt;Basically, there's a lot of good stuff out there, we're lucky to have such a good community around us. I would recommend a basic tutorial first, then try a couple of projects on your own.&lt;/P&gt;&lt;P&gt;What I wouldn't recommend are classroom based courses, my experience of them has been that you may as well learn at your own pace but it has also depended on what you are trying to learn (for tutorials and getting started, I dont think its necessary)&lt;/P&gt;&lt;P&gt;Pi&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 09:01:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821669#M1213588</guid>
      <dc:creator>PiEye</dc:creator>
      <dc:date>2021-07-13T09:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821700#M1213593</link>
      <description>&lt;P&gt;Yeah, replied to you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have one more question - this one seems to not be applicable to concatenated variable? Just tried and it doesn't seem to work. I guess its need to be mapped to variables from which concatenation starts?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 10:26:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821700#M1213593</guid>
      <dc:creator>QlickySense</dc:creator>
      <dc:date>2021-07-13T10:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for multiple variables</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821733#M1213594</link>
      <description>&lt;P&gt;True - it will apply to the whole field as it's loaded in. So you might need to load the fields first, then concatenate.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 12:11:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-for-multiple-variables/m-p/1821733#M1213594</guid>
      <dc:creator>PiEye</dc:creator>
      <dc:date>2021-07-13T12:11:28Z</dc:date>
    </item>
  </channel>
</rss>

