<?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: ApplyMap not working in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/ApplyMap-not-working/m-p/2077010#M1223875</link>
    <description>&lt;P&gt;Hi Ruben,&lt;/P&gt;
&lt;P&gt;Switching out the ID and the mapping column in the mapping table did the trick &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;for i = 1 to $(end)
	
    let current_dimension = SubField('$(dimensionlist)','-',$(i));
    let TABLE = 'D_$(current_dimension)';
    
    $(TABLE).MAP:
    Mapping Load
    	$(current_dimension).map,
        ID_$(current_dimension)
    Resident $(TABLE);
    
    
    left join (TEMP)
      load
      	  index_column,
      	  ApplyMap('$(TABLE).MAP',text($(current_dimension).map),'failure to map') as ID_$(current_dimension)
      Resident TEMP;
   drop fields $(current_dimension).map,$(current_dimension) from  TEMP;    
next;&lt;/LI-CODE&gt;
&lt;P&gt;Thanks for the help &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 28 May 2023 07:33:35 GMT</pubDate>
    <dc:creator>Kain_F</dc:creator>
    <dc:date>2023-05-28T07:33:35Z</dc:date>
    <item>
      <title>ApplyMap not working</title>
      <link>https://community.qlik.com/t5/QlikView/ApplyMap-not-working/m-p/2076894#M1223869</link>
      <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to automatically transform my table into a fact table based on known dimensions that are in the table.&lt;/P&gt;
&lt;P&gt;Before doing this I create a D_table for each dimension.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let dimensionlist = 'dimension1-dimension2-dimension3';
let end = SubStringCount('$(dimensionlist)','-')+1;

for i = 1 to $(end)
	
    let current_dimension = SubField('$(dimensionlist)','-',$(i));
    let TEMP_TABLE = 'D_$(current_dimension)_TEMP';
    let TABLE = 'D_$(current_dimension)';
   
    $(TEMP_TABLE):
    NoConcatenate
    load 
    	distinct
	(subfield(purgechar(lower($(current_dimension)),'"[]'),',')) as $(current_dimension).map
   	from [MySource.qvd] (qvd);
    
    $(TABLE):
    NoConcatenate
	Load
	RowNo() as ID_$(current_dimension),
    	$(current_dimension).map
	resident $(TEMP_TABLE);
	drop Table $(TEMP_TABLE);   
next;

&lt;/LI-CODE&gt;
&lt;P&gt;I then try to get my facttable as follows&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TEMP:
load 
	*,
    RowNo() as index_column,
    (subfield(purgechar(lower(dimension1),'"[]'),',')) as dimension1.map,
    (subfield(purgechar(lower(dimension2),'"[]'),',')) as dimension2.map,
    (subfield(purgechar(lower(dimension3),'"[]'),',')) as dimension3.map,
from [MySource.qvd] (qvd);


for i = 1 to $(end)
	
    let current_dimension = SubField('$(dimensionlist)','-',$(i));
    let TABLE = 'D_$(current_dimension)';
    
    $(TABLE).MAP:
    Mapping Load
    	*
    Resident $(TABLE);
    
    
    left join (TEMP)
      load
      	  index_column,
      	  ApplyMap('$(TABLE).MAP',text($(current_dimension).map),'failure to map') as ID_$(current_dimension)
      Resident TEMP;
   drop fields $(current_dimension).map,$(current_dimension) from  TEMP;    
next;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, even though i am generating a mapping table on each iteration of the dimension needed, the result in the final TEMP table for the columns&amp;nbsp;ID_dimension1,&amp;nbsp;ID_dimension2,I D_dimension3 is the default value of the ApplyMap function being 'failure to map' in my case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I cant seem to find a reason why I dont get the actual ID values for these dimensions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 16:59:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/ApplyMap-not-working/m-p/2076894#M1223869</guid>
      <dc:creator>Kain_F</dc:creator>
      <dc:date>2023-05-26T16:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: ApplyMap not working</title>
      <link>https://community.qlik.com/t5/QlikView/ApplyMap-not-working/m-p/2076966#M1223871</link>
      <description>&lt;P&gt;Hi, mapping table has two field: first is the values to search and the second is the value to return. I think the mapping table is using&amp;nbsp;ID_$(current_dimension) as the value to search, but in applymap you are looking by&amp;nbsp;text($(current_dimension).map), which is the value to return, not the value to search.&lt;/P&gt;
&lt;P&gt;Also the ID created by RowNo() would be a number, and in applymap the Text() fucntion will make a differnt format of the value to search.&lt;/P&gt;</description>
      <pubDate>Sat, 27 May 2023 07:34:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/ApplyMap-not-working/m-p/2076966#M1223871</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2023-05-27T07:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: ApplyMap not working</title>
      <link>https://community.qlik.com/t5/QlikView/ApplyMap-not-working/m-p/2077010#M1223875</link>
      <description>&lt;P&gt;Hi Ruben,&lt;/P&gt;
&lt;P&gt;Switching out the ID and the mapping column in the mapping table did the trick &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;for i = 1 to $(end)
	
    let current_dimension = SubField('$(dimensionlist)','-',$(i));
    let TABLE = 'D_$(current_dimension)';
    
    $(TABLE).MAP:
    Mapping Load
    	$(current_dimension).map,
        ID_$(current_dimension)
    Resident $(TABLE);
    
    
    left join (TEMP)
      load
      	  index_column,
      	  ApplyMap('$(TABLE).MAP',text($(current_dimension).map),'failure to map') as ID_$(current_dimension)
      Resident TEMP;
   drop fields $(current_dimension).map,$(current_dimension) from  TEMP;    
next;&lt;/LI-CODE&gt;
&lt;P&gt;Thanks for the help &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 May 2023 07:33:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/ApplyMap-not-working/m-p/2077010#M1223875</guid>
      <dc:creator>Kain_F</dc:creator>
      <dc:date>2023-05-28T07:33:35Z</dc:date>
    </item>
  </channel>
</rss>

