<?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: Can CASE statement be used in QV? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362089#M134578</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for the reply, would you be able to give a example of the Switch statement in QV - thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 21 Jul 2012 19:54:49 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-07-21T19:54:49Z</dc:date>
    <item>
      <title>Can CASE statement be used in QV?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362085#M134574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used to use CASE statement in SQL SELECT statements, what would be the equivalent expression in QV - thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jul 2012 19:40:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362085#M134574</guid>
      <dc:creator />
      <dc:date>2012-07-21T19:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can CASE statement be used in QV?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362086#M134575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd recommend ApplyMap().&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jul 2012 19:43:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362086#M134575</guid>
      <dc:creator>Jason_Michaelides</dc:creator>
      <dc:date>2012-07-21T19:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can CASE statement be used in QV?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362087#M134576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may also try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H1&gt;Switch..case..default..end switch&lt;/H1&gt;&lt;P&gt;statement (For details, see the Qlikview Reference manual)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jul 2012 19:44:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362087#M134576</guid>
      <dc:creator>nagaiank</dc:creator>
      <dc:date>2012-07-21T19:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Can CASE statement be used in QV?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362088#M134577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for the reply, would you be able to give a example of the Swtich statement in QV - thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jul 2012 19:54:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362088#M134577</guid>
      <dc:creator />
      <dc:date>2012-07-21T19:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Can CASE statement be used in QV?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362089#M134578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for the reply, would you be able to give a example of the Switch statement in QV - thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jul 2012 19:54:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362089#M134578</guid>
      <dc:creator />
      <dc:date>2012-07-21T19:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Can CASE statement be used in QV?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362090#M134579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An extract from the QV Reference Manual giving example of switch statement is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Examples:&lt;/H2&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;switch I&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;case 1&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;load '$(I): CASE 1' as case autogenerate 1;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;case 2&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;load '$(I): CASE 2' as case autogenerate 1;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;default&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;load '$(I): DEFAULT' as case autogenerate 1;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;end switch&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, the manual can be accessed from the help menu. A pdf file of the manual will be in the installation folder of the Qlikview desktop client (C:\Program Files\QlikView\Documentation)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jul 2012 20:09:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362090#M134579</guid>
      <dc:creator>nagaiank</dc:creator>
      <dc:date>2012-07-21T20:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can CASE statement be used in QV?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362091#M134580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The advantage of ApplyMap() is it's dynamic and control of the mapping can be passed to appropriate business users with a simple Excel document.&amp;nbsp; For example, let's say your CASE statement is to translate regions into abbreviations, you can set up an Excel doc:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Region | Abbrev&lt;/P&gt;&lt;P&gt;United Kingdom | UK&lt;/P&gt;&lt;P&gt;United States of America | USA&lt;/P&gt;&lt;P&gt;etc | etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and appropriate users can control the mapping by being granted access to the Excel file.&amp;nbsp; Then, in your load script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Map_Regions:&lt;/P&gt;&lt;P&gt;MAPPING LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Region&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,Abbrev&lt;/P&gt;&lt;P&gt;FROM...ExcelDoc...;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Field1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,Field2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,Field3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,ApplyMap('Map_Regions',Field4,'&amp;lt;Unknown&amp;gt;')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RegionAbbrev&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;SQL SELECT....;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your Field4 is the full region name in your database.&lt;/P&gt;&lt;P&gt;Now, any changes made by your users would take effect automatically at the next reload without you having to get involved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jul 2012 21:59:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362091#M134580</guid>
      <dc:creator>Jason_Michaelides</dc:creator>
      <dc:date>2012-07-21T21:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Can CASE statement be used in QV?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362092#M134581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jason, Many thanks for your reply and for your time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I use values from two fields in the mapping, (that is if the value from a field meets a certain criteria then it should pick the value from another field)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the SQL statement it would look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE when WWHS = "IT' then LLOC ELSE WWHS END&lt;/P&gt;&lt;P&gt;(where WWHS was the warehouse field and if the warehouse was 'IT" then it would be substituted with a value in the Location field)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jul 2012 22:09:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362092#M134581</guid>
      <dc:creator />
      <dc:date>2012-07-21T22:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: Can CASE statement be used in QV?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362093#M134582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many thanks for your reply and for your time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I use values from two fields in the mapping, (that is if the value from a field meets a certain criteria then it should pick the value from another field)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the SQL statement it would look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE when WWHS = "IT' then LLOC ELSE WWHS END&lt;/P&gt;&lt;P&gt;(where WWHS was the warehouse field and if the warehouse was 'IT" then it would be substituted with a value in the Location field)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jul 2012 22:10:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362093#M134582</guid>
      <dc:creator />
      <dc:date>2012-07-21T22:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can CASE statement be used in QV?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362094#M134583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ApplyMap() is for looking up values from a field and returning mapped values from a different source.&amp;nbsp; Are you saying that dependent on the value of WWHS you want to return the current row value from another field?&amp;nbsp; In this case if WWHS='IT' then use the value from LLOC, otherwise leave it as WWHS.&amp;nbsp; What if WWHS='IT2'.&amp;nbsp; Would you return a value from another field entirely?&amp;nbsp; Maybe LLOC2?&amp;nbsp; If not then a simple IF() statement might be your best shot:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;Data:&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;LOAD&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Field1&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,Field2&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,Field3&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,IF(WWHS='IT',LLOC,WWHS)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHSLoc&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;SQL SELECT....;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Jul 2012 09:47:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362094#M134583</guid>
      <dc:creator>Jason_Michaelides</dc:creator>
      <dc:date>2012-07-22T09:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: Can CASE statement be used in QV?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362095#M134584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;With mappings, you have the option to define the default value when you apply it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ApplyMap ('MapName', MapField, 'defaultIfNull');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the default value, you can add another mapping expression. So if you don't have a match in the first map, you can use the second map. Or you could concatenate 2 mapping tables into one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have more complex stuff with a lot of rules, then the best approach woult be to join the main table the other needed tables with the values you want, to a temp table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempTable:&lt;/P&gt;&lt;P&gt;Select field1, field2, field3 from yourmaintable.&lt;/P&gt;&lt;P&gt;Left Join &lt;/P&gt;&lt;P&gt;Load field3, field4&amp;nbsp; resident maptable1; /*These are not qlikview maps, but normal tables that you will delete in the end of the code.*/&lt;/P&gt;&lt;P&gt;Left Join &lt;/P&gt;&lt;P&gt;Load&amp;nbsp; field3, field5&amp;nbsp; resident maptable2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then with a load resident of the temp table, insert your logic to select the &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FinalTable:&lt;/P&gt;&lt;P&gt;Load *, if(isnull(Field4), Field5,Field4) as yourfieldName;&lt;/P&gt;&lt;P&gt;Load * resident TempTable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop Fields Field5, Field4 from FinalTable;&lt;/P&gt;&lt;P&gt;Drop tables TempTable, maptable1, maptable2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its very important that you use a left Join, in order to mantain the whole data from the temp table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 14:09:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-CASE-statement-be-used-in-QV/m-p/362095#M134584</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-23T14:09:20Z</dc:date>
    </item>
  </channel>
</rss>

