<?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 Implementing multiple Decode statements in QV in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Implementing-multiple-Decode-statements-in-QV/m-p/218376#M71520</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class="example_heading"&gt;For example:&lt;/P&gt;&lt;P&gt;You could use the decode function in an SQL statement as follows:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;DIV style="text-align: left"&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" class="sql_command" width="400"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD colspan="3" width="398"&gt;SELECT supplier_name,&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="121"&gt;decode(supplier_id,&lt;/TD&gt;&lt;TD width="47"&gt;10000,&lt;/TD&gt;&lt;TD width="226"&gt;'IBM',&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="121"&gt;&lt;/TD&gt;&lt;TD width="47"&gt;10001,&lt;/TD&gt;&lt;TD width="226"&gt;'Microsoft',&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="121"&gt;&lt;/TD&gt;&lt;TD width="47"&gt;10002,&lt;/TD&gt;&lt;TD width="226"&gt;'Hewlett Packard',&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="121"&gt;&lt;/TD&gt;&lt;TD width="47"&gt;&lt;/TD&gt;&lt;TD width="226"&gt;'Gateway') result&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD colspan="3" width="398"&gt;FROM suppliers;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above decode statement is equivalent to the following IF-THEN-ELSE statement:&lt;/P&gt;&lt;BLOCKQUOTE class="sql_command"&gt;&lt;P&gt;IF supplier_id = 10000 THEN&lt;BR /&gt; result := 'IBM';&lt;/P&gt;&lt;P&gt;ELSIF supplier_id = 10001 THEN&lt;BR /&gt; result := 'Microsoft';&lt;/P&gt;&lt;P&gt;ELSIF supplier_id = 10002 THEN&lt;BR /&gt; result := 'Hewlett Packard';&lt;/P&gt;&lt;P&gt;ELSE&lt;BR /&gt; result := 'Gateway';&lt;/P&gt;&lt;P&gt;END IF;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Dec 2010 03:21:48 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-12-14T03:21:48Z</dc:date>
    <item>
      <title>Implementing multiple Decode statements in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Implementing-multiple-Decode-statements-in-QV/m-p/218373#M71517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are migrating a reporting application from Discoverer to Qlikview, In one of the reports the discoverer uses multiple Decode statements in order to acheive the business purpose and provide the correct data. I have the following piece of code in Discoverer:&lt;/P&gt;&lt;P&gt;DECODE(o116396. REGION,'JPN','OJM','JFG','OJM','US','FRE',&lt;/P&gt;&lt;P&gt;DECODE((&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;DECODE(NVL(o163832. SHIP_FROM_ORG_ID,99),23,'GLO',28,'OIM',29,'OUR',33,'OJS',34,'OJM',37&lt;/P&gt;&lt;P&gt;,'ODM',38,'FRE',39,'VMM',61,'JCI',62,'JSC',81,'UCI',82,'ECI',101,'OCF',161,'JDM',181,'UDS',202&lt;/P&gt;&lt;P&gt;,'ODS',221,'BEI',441,'CSS',241,'PCM',322,'PBU','442','OPS',361,'VMP',99,' ',CONCAT('NOT MAPPED: Org ID ',TO_CHAR(o163832. SHIP_FROM_ORG_ID)))&lt;/P&gt;&lt;P&gt;),'JCI','OJM','Unknown'))) as C_2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest what is the best way to implement this is qlikview, Any sample code in QV will be highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kingshuk&lt;/P&gt;&lt;P&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, 09 Dec 2010 01:56:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Implementing-multiple-Decode-statements-in-QV/m-p/218373#M71517</guid>
      <dc:creator />
      <dc:date>2010-12-09T01:56:31Z</dc:date>
    </item>
    <item>
      <title>Implementing multiple Decode statements in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Implementing-multiple-Decode-statements-in-QV/m-p/218374#M71518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The easiest way would be to embed that as a field in your load script, passing the DECODE statement to Oracle in your SQL statement. That way you don't have to change a thing (assuming that it already works).&lt;/P&gt;&lt;P&gt;Otherwise you'll have to do something like this with QV if's, with many more levels. Replace 'bla...' with many more if's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(o116396. REGION='JPN','OJM',&lt;/P&gt;&lt;P&gt;if(o116396. REGION='JFG','OJM',&lt;/P&gt;&lt;P&gt;if(o116396. REGION='US','FRE','bla...')&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;) as C_2&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 02:48:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Implementing-multiple-Decode-statements-in-QV/m-p/218374#M71518</guid>
      <dc:creator />
      <dc:date>2010-12-09T02:48:02Z</dc:date>
    </item>
    <item>
      <title>Implementing multiple Decode statements in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Implementing-multiple-Decode-statements-in-QV/m-p/218375#M71519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not totally sure how DECODE syntax works, but it looks like you could use QlikView Mapping tables to achieve similar results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 07:15:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Implementing-multiple-Decode-statements-in-QV/m-p/218375#M71519</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2010-12-09T07:15:16Z</dc:date>
    </item>
    <item>
      <title>Implementing multiple Decode statements in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Implementing-multiple-Decode-statements-in-QV/m-p/218376#M71520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class="example_heading"&gt;For example:&lt;/P&gt;&lt;P&gt;You could use the decode function in an SQL statement as follows:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;DIV style="text-align: left"&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" class="sql_command" width="400"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD colspan="3" width="398"&gt;SELECT supplier_name,&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="121"&gt;decode(supplier_id,&lt;/TD&gt;&lt;TD width="47"&gt;10000,&lt;/TD&gt;&lt;TD width="226"&gt;'IBM',&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="121"&gt;&lt;/TD&gt;&lt;TD width="47"&gt;10001,&lt;/TD&gt;&lt;TD width="226"&gt;'Microsoft',&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="121"&gt;&lt;/TD&gt;&lt;TD width="47"&gt;10002,&lt;/TD&gt;&lt;TD width="226"&gt;'Hewlett Packard',&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="121"&gt;&lt;/TD&gt;&lt;TD width="47"&gt;&lt;/TD&gt;&lt;TD width="226"&gt;'Gateway') result&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD colspan="3" width="398"&gt;FROM suppliers;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above decode statement is equivalent to the following IF-THEN-ELSE statement:&lt;/P&gt;&lt;BLOCKQUOTE class="sql_command"&gt;&lt;P&gt;IF supplier_id = 10000 THEN&lt;BR /&gt; result := 'IBM';&lt;/P&gt;&lt;P&gt;ELSIF supplier_id = 10001 THEN&lt;BR /&gt; result := 'Microsoft';&lt;/P&gt;&lt;P&gt;ELSIF supplier_id = 10002 THEN&lt;BR /&gt; result := 'Hewlett Packard';&lt;/P&gt;&lt;P&gt;ELSE&lt;BR /&gt; result := 'Gateway';&lt;/P&gt;&lt;P&gt;END IF;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Dec 2010 03:21:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Implementing-multiple-Decode-statements-in-QV/m-p/218376#M71520</guid>
      <dc:creator />
      <dc:date>2010-12-14T03:21:48Z</dc:date>
    </item>
    <item>
      <title>Implementing multiple Decode statements in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Implementing-multiple-Decode-statements-in-QV/m-p/218377#M71521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, exactly - MAPPING TABLE is the QlikView way of achieving the same result - you load your pais of "decode" values into a mapping table, and then you use function ApplyMap() to perform the "decoding" of a specific value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Dec 2010 04:00:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Implementing-multiple-Decode-statements-in-QV/m-p/218377#M71521</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2010-12-14T04:00:10Z</dc:date>
    </item>
  </channel>
</rss>

