<?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: Functions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Functions/m-p/806314#M1041175</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jana&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The mapsubstring() function is similar to the applymap() function, except that it maps part of a string instead of the full string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to use these functions, and any mapping functions, you need to declare a mapping table. This is your "lookup" table and just comprises two fields- the reference field first, and the description field second.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can then reference the mapping table in functions to replace codes in the data with text. The applymap() function replaces an entire field value with the description, and the mapsubstring() function replaces part of it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See below code to experiment for yourself (this will load on it's own in a QV script)&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 the mapping info - in this case Country codes to country names&lt;/P&gt;&lt;P&gt;Country_Map:&lt;/P&gt;&lt;P&gt;Mapping load *;&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Country_Code, Country_Name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UK, United Kingdom&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; BR, Brazil&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RU, Russia&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IN, India&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CH, China&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 the data that needs to be mapped&lt;/P&gt;&lt;P&gt;Messy_Data:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Row, Data 1, Data 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, BR, In sunny BR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, BR, I love Rio in BR!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, RU, RU is very cold in winter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4, UK, The UK is very rainy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5, CH, CH&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left join (Messy_Data)&lt;/P&gt;&lt;P&gt;Load Row,&amp;nbsp; //This will automatically join on the field Row&lt;/P&gt;&lt;P&gt;&amp;nbsp; ApplyMap('Country_Map',[Data 1]) as Fn_ApplyMap,&lt;/P&gt;&lt;P&gt;&amp;nbsp; MapSubString('Country_Map',[Data 2]) as Fn_MapSubString&lt;/P&gt;&lt;P&gt;resident Messy_Data; //joins it onto itself&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result is this table:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Dec 2014 12:35:55 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-12-10T12:35:55Z</dc:date>
    <item>
      <title>Functions</title>
      <link>https://community.qlik.com/t5/QlikView/Functions/m-p/806312#M1041173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anyone provide some material with example for function&lt;STRONG&gt; "Map substring()"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance&lt;/P&gt;&lt;P&gt;Jana.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 12:21:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Functions/m-p/806312#M1041173</guid>
      <dc:creator />
      <dc:date>2014-12-10T12:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: Functions</title>
      <link>https://community.qlik.com/t5/QlikView/Functions/m-p/806313#M1041174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Example from QV help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;map1: &lt;/P&gt;&lt;P class="Code"&gt;mapping load * inline [ &lt;/P&gt;&lt;P class="Code"&gt;x, y &lt;/P&gt;&lt;P class="Code"&gt;1, &amp;lt;one&amp;gt; &lt;/P&gt;&lt;P class="Code"&gt;aa, XYZ &lt;/P&gt;&lt;P class="Code"&gt;x, b ] ; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;MapSubstring ('map1', 'A123')&lt;/SPAN&gt; returns 'A&amp;lt;one&amp;gt;23'&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;MapSubstring ('map1', 'baaar')&lt;/SPAN&gt; returns 'bXYZar'&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;MapSubstring ('map1', 'xaa1')&lt;/SPAN&gt; returns 'bXYZ&amp;lt;one&amp;gt;'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 12:28:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Functions/m-p/806313#M1041174</guid>
      <dc:creator>anbu1984</dc:creator>
      <dc:date>2014-12-10T12:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Functions</title>
      <link>https://community.qlik.com/t5/QlikView/Functions/m-p/806314#M1041175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jana&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The mapsubstring() function is similar to the applymap() function, except that it maps part of a string instead of the full string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to use these functions, and any mapping functions, you need to declare a mapping table. This is your "lookup" table and just comprises two fields- the reference field first, and the description field second.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can then reference the mapping table in functions to replace codes in the data with text. The applymap() function replaces an entire field value with the description, and the mapsubstring() function replaces part of it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See below code to experiment for yourself (this will load on it's own in a QV script)&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 the mapping info - in this case Country codes to country names&lt;/P&gt;&lt;P&gt;Country_Map:&lt;/P&gt;&lt;P&gt;Mapping load *;&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Country_Code, Country_Name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UK, United Kingdom&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; BR, Brazil&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RU, Russia&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IN, India&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CH, China&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 the data that needs to be mapped&lt;/P&gt;&lt;P&gt;Messy_Data:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Row, Data 1, Data 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, BR, In sunny BR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, BR, I love Rio in BR!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, RU, RU is very cold in winter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4, UK, The UK is very rainy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5, CH, CH&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left join (Messy_Data)&lt;/P&gt;&lt;P&gt;Load Row,&amp;nbsp; //This will automatically join on the field Row&lt;/P&gt;&lt;P&gt;&amp;nbsp; ApplyMap('Country_Map',[Data 1]) as Fn_ApplyMap,&lt;/P&gt;&lt;P&gt;&amp;nbsp; MapSubString('Country_Map',[Data 2]) as Fn_MapSubString&lt;/P&gt;&lt;P&gt;resident Messy_Data; //joins it onto itself&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result is this table:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 12:35:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Functions/m-p/806314#M1041175</guid>
      <dc:creator />
      <dc:date>2014-12-10T12:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Functions</title>
      <link>https://community.qlik.com/t5/QlikView/Functions/m-p/806315#M1041176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE bgcolor="#ffffff" border="1" cellpadding="2" cellspacing="0" style="font-size: 9pt;"&gt;&lt;TBODY&gt;&lt;TR bgcolor="#f5f5f5"&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;Row&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;Data 1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;Data 2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;Fn_ApplyMap&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;Fn_MapSubString&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR bgcolor="#ffffff"&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;BR&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;In sunny BR&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;Brazil&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;In sunny Brazil&lt;/SPAN&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR bgcolor="#ffffff"&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;BR&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;I love Rio in BR!&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;Brazil&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;I love Rio in Brazil!&lt;/SPAN&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR bgcolor="#ffffff"&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;3&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;RU&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;RU is very cold in winter&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;Russia&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;Russia is very cold in winter&lt;/SPAN&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR bgcolor="#ffffff"&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;4&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;UK&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;The UK is very rainy&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;United Kingdom&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;The United Kingdom is very rainy&lt;/SPAN&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR bgcolor="#ffffff"&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;CH&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;CH&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;China&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;China&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see the ApplyMap() function has replaced the entire field value, where as the &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other points to note: &lt;/P&gt;&lt;P&gt; - The mapping functions are case sensitive&lt;/P&gt;&lt;P&gt;- MapSubstring() will replace the lookup values multiple times in a string, no matter where they are so take care! in the example above, the word "BRITISH" will have the BR replaced to "Brazil" and would look like "BrazilITISH"&lt;/P&gt;&lt;P&gt;- Using mapping functions is far more efficient thans using lookup functions - there is plenty of material else where that explains why.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erica&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 12:39:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Functions/m-p/806315#M1041176</guid>
      <dc:creator />
      <dc:date>2014-12-10T12:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: Functions</title>
      <link>https://community.qlik.com/t5/QlikView/Functions/m-p/806316#M1041177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From Qv Help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;SPAN class="Bold"&gt;MapSubstring&lt;/SPAN&gt; function is used to map parts of any expression to a previously loaded mapping table. The mapping is case sensitive and non-iterative and substrings are mapped from left to right. The syntax is:&lt;/P&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Bold"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Bold"&gt;mapsubstring(&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;'mapname', expr&lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This function can be used with mapping parts of any expression on a previously loaded mapping table. The mapping is case sensitive and non-recursive. The substrings are mapped from the left to the right. &lt;SPAN class="Italic"&gt;Mapname&lt;/SPAN&gt; is the name of a mapping table previously read by a &lt;SPAN class="Bold"&gt;mapping load&lt;/SPAN&gt;&amp;nbsp; a &lt;SPAN class="Bold"&gt;mapping select&lt;/SPAN&gt; statement. The name must be enclosed by single straight quotation marks. &lt;SPAN class="Italic"&gt;Expr&lt;/SPAN&gt; is the expression whose result should be mapped by substrings.&lt;/P&gt;&lt;P class="example"&gt;Examples:&lt;/P&gt;&lt;P class="Code"&gt;// Assume the following mapping table:&lt;/P&gt;&lt;P class="Code"&gt;map1:&lt;/P&gt;&lt;P class="Code"&gt;mapping load * inline [&lt;/P&gt;&lt;P class="Code"&gt;x, y&lt;/P&gt;&lt;P class="Code"&gt;1, &amp;lt;one&amp;gt;&lt;/P&gt;&lt;P class="Code"&gt;aa, XYZ&lt;/P&gt;&lt;P class="Code"&gt;x, b ] ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;MapSubstring ('map1', 'A123')&lt;/SPAN&gt; returns 'A&amp;lt;one&amp;gt;23'&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;MapSubstring ('map1', 'baaar')&lt;/SPAN&gt; returns 'bXYZar'&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;MapSubstring ('map1', 'xaa1')&lt;/SPAN&gt; returns 'bXYZ&amp;lt;one&amp;gt;'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 12:46:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Functions/m-p/806316#M1041177</guid>
      <dc:creator>its_anandrjs</dc:creator>
      <dc:date>2014-12-10T12:46:04Z</dc:date>
    </item>
  </channel>
</rss>

