<?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 Trouble with Mapping Load and WildMatch in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Trouble-with-Mapping-Load-and-WildMatch/m-p/1986198#M81467</link>
    <description>&lt;P&gt;Hi, I have a what should be a simple problem, but I just can't seem to solve it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Simplifying this a bit, but I have a table of transactions which contains various attributes. For each transaction, there is a description.&amp;nbsp; The data looks like this:&lt;/P&gt;
&lt;TABLE border="1" width="98.09550679141404%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;ClientID&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;Transaction&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;Description&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;001&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;High value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="30px"&gt;001&lt;/TD&gt;
&lt;TD height="30px"&gt;2&lt;/TD&gt;
&lt;TD height="30px"&gt;Medium value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="30px"&gt;001&lt;/TD&gt;
&lt;TD height="30px"&gt;3&lt;/TD&gt;
&lt;TD height="30px"&gt;Low value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="24px"&gt;002&lt;/TD&gt;
&lt;TD height="24px"&gt;1&lt;/TD&gt;
&lt;TD height="24px"&gt;Low value&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If a client ID has a description that contains "high value", I would like to flag that client ID. So, I have done a Mapping Load using WildMatch (as each description isn't as clean as above). So, the code looks like this:&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;HighValueFlag:
    Mapping LOAD 
    "ClientID",
    if(WildMatch("Description", '*High*'), 'Y', 'N') as Flag;
SQL ....

FinalTable:
    "ClientID",
    "Transaction",
    ApplyMap ('HighValueFlag', "ClientID", 0) as Flag;
SQL....
&lt;/LI-CODE&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;
&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;I am pulling from the same table in the database using SQL that's why I have the proceeding loads. I wouldn't expect that to be a problem but I am not sure.&lt;/P&gt;
&lt;P&gt;But, basically, I want the final data to look like and apply the Y flag to all instances of the client ID so I can toggle on/off "high value" clients:&lt;/P&gt;
&lt;TABLE border="1" width="101.94280947573073%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;ClientID&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;Transaction&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="31px"&gt;Description&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;Flag&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;001&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;1&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="31px"&gt;High value&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;Y&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;001&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;2&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="31px"&gt;Medium value&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;Y&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;001&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;3&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="31px"&gt;Low value&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;Y&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="24px"&gt;002&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="24px"&gt;1&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="24px"&gt;Low value&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;N&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any direction on this? As it stands now, the data is just returning N for all Client IDs when using the Apply Map.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Sep 2022 19:21:21 GMT</pubDate>
    <dc:creator>RJW</dc:creator>
    <dc:date>2022-09-27T19:21:21Z</dc:date>
    <item>
      <title>Trouble with Mapping Load and WildMatch</title>
      <link>https://community.qlik.com/t5/App-Development/Trouble-with-Mapping-Load-and-WildMatch/m-p/1986198#M81467</link>
      <description>&lt;P&gt;Hi, I have a what should be a simple problem, but I just can't seem to solve it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Simplifying this a bit, but I have a table of transactions which contains various attributes. For each transaction, there is a description.&amp;nbsp; The data looks like this:&lt;/P&gt;
&lt;TABLE border="1" width="98.09550679141404%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;ClientID&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;Transaction&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;Description&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;001&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;High value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="30px"&gt;001&lt;/TD&gt;
&lt;TD height="30px"&gt;2&lt;/TD&gt;
&lt;TD height="30px"&gt;Medium value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="30px"&gt;001&lt;/TD&gt;
&lt;TD height="30px"&gt;3&lt;/TD&gt;
&lt;TD height="30px"&gt;Low value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="24px"&gt;002&lt;/TD&gt;
&lt;TD height="24px"&gt;1&lt;/TD&gt;
&lt;TD height="24px"&gt;Low value&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If a client ID has a description that contains "high value", I would like to flag that client ID. So, I have done a Mapping Load using WildMatch (as each description isn't as clean as above). So, the code looks like this:&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;HighValueFlag:
    Mapping LOAD 
    "ClientID",
    if(WildMatch("Description", '*High*'), 'Y', 'N') as Flag;
SQL ....

FinalTable:
    "ClientID",
    "Transaction",
    ApplyMap ('HighValueFlag', "ClientID", 0) as Flag;
SQL....
&lt;/LI-CODE&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;
&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;I am pulling from the same table in the database using SQL that's why I have the proceeding loads. I wouldn't expect that to be a problem but I am not sure.&lt;/P&gt;
&lt;P&gt;But, basically, I want the final data to look like and apply the Y flag to all instances of the client ID so I can toggle on/off "high value" clients:&lt;/P&gt;
&lt;TABLE border="1" width="101.94280947573073%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;ClientID&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;Transaction&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="31px"&gt;Description&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;Flag&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;001&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;1&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="31px"&gt;High value&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;Y&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;001&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;2&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="31px"&gt;Medium value&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;Y&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;001&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="31px"&gt;3&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="31px"&gt;Low value&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;Y&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="24px"&gt;002&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="24px"&gt;1&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="24px"&gt;Low value&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;N&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any direction on this? As it stands now, the data is just returning N for all Client IDs when using the Apply Map.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 19:21:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Trouble-with-Mapping-Load-and-WildMatch/m-p/1986198#M81467</guid>
      <dc:creator>RJW</dc:creator>
      <dc:date>2022-09-27T19:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with Mapping Load and WildMatch</title>
      <link>https://community.qlik.com/t5/App-Development/Trouble-with-Mapping-Load-and-WildMatch/m-p/1986215#M81469</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Here is the resultant table from the script used below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mansoorsheraz_0-1664308747330.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/90062iD1B49A3FB29C4099/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mansoorsheraz_0-1664308747330.png" alt="mansoorsheraz_0-1664308747330.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;This may solve your issue&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;[temp]:&lt;BR /&gt;Load * inline [&lt;BR /&gt;ClientID, Transaction, Description&lt;BR /&gt;001, 1, High value&lt;BR /&gt;001, 2, Medium value&lt;BR /&gt;001, 3, Low value&lt;BR /&gt;002, 1, Low value&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;[values]:&lt;BR /&gt;Load&lt;BR /&gt;ClientID,&lt;BR /&gt;ClientID as CLID,&lt;BR /&gt;'Y' as Flag&lt;BR /&gt;Resident [temp]&lt;BR /&gt;where Description = 'High value';&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Concatenate ([values])&lt;/P&gt;
&lt;P&gt;Load&lt;BR /&gt;ClientID,&lt;BR /&gt;'N' as Flag&lt;BR /&gt;Resident [temp] &lt;BR /&gt;where not Exists("CLID", ClientID);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;[TempFinal]:&lt;BR /&gt;NoConcatenate&lt;BR /&gt;Load &lt;BR /&gt;ClientID, &lt;BR /&gt;Transaction, &lt;BR /&gt;Description&lt;BR /&gt;Resident [temp];&lt;/P&gt;
&lt;P&gt;Join&lt;/P&gt;
&lt;P&gt;Load &lt;BR /&gt;ClientID, &lt;BR /&gt;Flag&lt;BR /&gt;Resident [values];&lt;/P&gt;
&lt;P&gt;[Final]:&lt;BR /&gt;NoConcatenate&lt;BR /&gt;Load ClientID, &lt;BR /&gt;Transaction,&lt;BR /&gt;Description,&lt;BR /&gt;Flag&lt;BR /&gt;Resident [TempFinal];&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;drop table [temp];&lt;BR /&gt;drop table [values];&lt;BR /&gt;drop table [TempFinal];&lt;/P&gt;
&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 19:59:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Trouble-with-Mapping-Load-and-WildMatch/m-p/1986215#M81469</guid>
      <dc:creator>mansoorsheraz</dc:creator>
      <dc:date>2022-09-27T19:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with Mapping Load and WildMatch</title>
      <link>https://community.qlik.com/t5/App-Development/Trouble-with-Mapping-Load-and-WildMatch/m-p/1986316#M81484</link>
      <description>&lt;P&gt;A mapping in Qlik behaved like a vlookup in Excel and returned always the value from the first match. But your clients don't have only one transaction else n ones.&lt;/P&gt;
&lt;P&gt;In many scenarios you would need to aggregate your n values at first to calculate with them against the grouping dimension. But in this case you could avoid it by filtering the mapping table. This may look like;&lt;/P&gt;
&lt;PRE class="language-markup"&gt;&lt;CODE&gt;HighValueFlag:
    Mapping LOAD 
    "ClientID",
    'Y' as Flag where WildMatch("Description", '*High*');
SQL ....

FinalTable:
    "ClientID",
    "Transaction",
    ApplyMap ('HighValueFlag', "ClientID", 'N') as Flag;
SQL....&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 06:25:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Trouble-with-Mapping-Load-and-WildMatch/m-p/1986316#M81484</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2022-09-28T06:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with Mapping Load and WildMatch</title>
      <link>https://community.qlik.com/t5/App-Development/Trouble-with-Mapping-Load-and-WildMatch/m-p/1986582#M81519</link>
      <description>&lt;P&gt;Hi Marcus, thanks so much for your comment.&amp;nbsp; This is exactly what I was looking. The data returns as expected!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 14:53:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Trouble-with-Mapping-Load-and-WildMatch/m-p/1986582#M81519</guid>
      <dc:creator>RJW</dc:creator>
      <dc:date>2022-09-28T14:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with Mapping Load and WildMatch</title>
      <link>https://community.qlik.com/t5/App-Development/Trouble-with-Mapping-Load-and-WildMatch/m-p/1986605#M81525</link>
      <description>&lt;P&gt;Hi, this works!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ended up going with Marcus's solution as it was easier to implement but thanks for your solution as well. Very nice!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 14:54:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Trouble-with-Mapping-Load-and-WildMatch/m-p/1986605#M81525</guid>
      <dc:creator>RJW</dc:creator>
      <dc:date>2022-09-28T14:54:39Z</dc:date>
    </item>
  </channel>
</rss>

