<?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: Add mapped column to already loaded table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Add-mapped-column-to-already-loaded-table/m-p/81425#M608080</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the quick reply!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not receiving an error message but I get a strange result after I run it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I drop the ResultTable after applying the map then my OriginalTable values are unaffected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I DON'T drop the ResultTable after applying the map then I get a synthetic key generated tying my ResultTable to my OriginalTable, and my OriginalTable's data ends up empty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The end result should be:&lt;BR /&gt;OriginalTable:&lt;BR /&gt;searchColumn, otherColumn, otherColumn1, &lt;STRONG&gt;newColumn,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;origdata,origdata,origdata,&lt;STRONG&gt;newData&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Demo Code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OriginalTable:&lt;/P&gt;&lt;P&gt;Load * Inline [&lt;/P&gt;&lt;P&gt;NT; Token&lt;/P&gt;&lt;P&gt;ICMS; '5NNNN'&lt;/P&gt;&lt;P&gt;ICNS; '5NNNM'&lt;/P&gt;&lt;P&gt;](delimiter is ';');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub LoadCredentials( vSourceTable, vSourceToken)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempTokenTable:&lt;/P&gt;&lt;P&gt;Load Distinct&lt;/P&gt;&lt;P&gt;$(vSourceToken) As DistinctToken&lt;/P&gt;&lt;P&gt;resident $(vSourceTable);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vRunCount = fieldvaluecount('DistinctToken');&lt;/P&gt;&lt;P&gt;Let i = 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for&amp;nbsp; i to vRunCount step 1&lt;/P&gt;&lt;P&gt;Let vCurToken = Peek('DistinctToken', $(i), 'TempTokenTable');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//api call that generates a result set with Token value to Credential value... below code is just to rebuild the &lt;/P&gt;&lt;P&gt;//output since I can't place the api call and restructure here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next i;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ResultTable:&lt;/P&gt;&lt;P&gt;mapping Load * Inline [&lt;/P&gt;&lt;P&gt;Token; Credential&lt;/P&gt;&lt;P&gt;'5NNNN'; 'Cred1'&lt;/P&gt;&lt;P&gt;'5NNNM'; 'Cred2'&lt;/P&gt;&lt;P&gt;](delimiter is ';');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load *, ApplyMap('ResultTable', $(vSourceToken) , 'Not Available') As [Credential] resident OriginalTable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop Table ResultTable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call LoadCredentials('OriginalTable', 'Token');&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 again for taking a look at this with me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Mar 2018 19:25:51 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-03-09T19:25:51Z</dc:date>
    <item>
      <title>Add mapped column to already loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-mapped-column-to-already-loaded-table/m-p/81423#M608078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hoping for some help with adding a column to an already loaded table.&amp;nbsp; I have to load the table initially to obtain the values for a subroutine to run.&amp;nbsp; When the subroutine returns it gives me an additional field to add back to the dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OriginalTable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;load *;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;sql select&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;searchColumn,&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;otherColumn,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;otherColumn1&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;from dbo.table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Sub mySub (&lt;STRONG&gt;searchColumn&lt;/STRONG&gt;, OriginalTable)&lt;/P&gt;&lt;P&gt;\\some processes here that succesfully obtain back a new column of data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;ResultTable:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;searchColumn,&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;newColumn&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MappingTable:&lt;/P&gt;&lt;P&gt;mapping load &lt;STRONG&gt;searchColumn&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newColumn&lt;/P&gt;&lt;P&gt;resident ResultTable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//This part is the area where I'm struggling.&amp;nbsp; I'm trying to get the newColumn from ResultTable onto OriginalTable as an additional field.&lt;BR /&gt;&lt;BR /&gt;Load *, applymap('MappingTable', 'searchColumn', 'Not available') As newColumn resident OriginalTable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was able to get the end result by simply making a new table which is a combination of OriginalTable and ResultTable (via join) but I'm hoping there is a more efficient method than making an entirely new table and dropping the original.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help you can provide!&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2018 16:01:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-mapped-column-to-already-loaded-table/m-p/81423#M608078</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-09T16:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Add mapped column to already loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-mapped-column-to-already-loaded-table/m-p/81424#M608079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your mapping table looks right.&lt;/P&gt;&lt;P&gt;Can you please post the error message you get.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, no quotes for the key&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Applymap('MappingTable',&lt;STRONG style="text-decoration: underline;"&gt; SearchColumn&lt;/STRONG&gt;, 'Not Available') as NewColumn&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2018 18:39:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-mapped-column-to-already-loaded-table/m-p/81424#M608079</guid>
      <dc:creator>vamsee</dc:creator>
      <dc:date>2018-03-09T18:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Add mapped column to already loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-mapped-column-to-already-loaded-table/m-p/81425#M608080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the quick reply!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not receiving an error message but I get a strange result after I run it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I drop the ResultTable after applying the map then my OriginalTable values are unaffected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I DON'T drop the ResultTable after applying the map then I get a synthetic key generated tying my ResultTable to my OriginalTable, and my OriginalTable's data ends up empty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The end result should be:&lt;BR /&gt;OriginalTable:&lt;BR /&gt;searchColumn, otherColumn, otherColumn1, &lt;STRONG&gt;newColumn,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;origdata,origdata,origdata,&lt;STRONG&gt;newData&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Demo Code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OriginalTable:&lt;/P&gt;&lt;P&gt;Load * Inline [&lt;/P&gt;&lt;P&gt;NT; Token&lt;/P&gt;&lt;P&gt;ICMS; '5NNNN'&lt;/P&gt;&lt;P&gt;ICNS; '5NNNM'&lt;/P&gt;&lt;P&gt;](delimiter is ';');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub LoadCredentials( vSourceTable, vSourceToken)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempTokenTable:&lt;/P&gt;&lt;P&gt;Load Distinct&lt;/P&gt;&lt;P&gt;$(vSourceToken) As DistinctToken&lt;/P&gt;&lt;P&gt;resident $(vSourceTable);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vRunCount = fieldvaluecount('DistinctToken');&lt;/P&gt;&lt;P&gt;Let i = 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for&amp;nbsp; i to vRunCount step 1&lt;/P&gt;&lt;P&gt;Let vCurToken = Peek('DistinctToken', $(i), 'TempTokenTable');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//api call that generates a result set with Token value to Credential value... below code is just to rebuild the &lt;/P&gt;&lt;P&gt;//output since I can't place the api call and restructure here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next i;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ResultTable:&lt;/P&gt;&lt;P&gt;mapping Load * Inline [&lt;/P&gt;&lt;P&gt;Token; Credential&lt;/P&gt;&lt;P&gt;'5NNNN'; 'Cred1'&lt;/P&gt;&lt;P&gt;'5NNNM'; 'Cred2'&lt;/P&gt;&lt;P&gt;](delimiter is ';');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load *, ApplyMap('ResultTable', $(vSourceToken) , 'Not Available') As [Credential] resident OriginalTable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop Table ResultTable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call LoadCredentials('OriginalTable', 'Token');&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 again for taking a look at this with me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2018 19:25:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-mapped-column-to-already-loaded-table/m-p/81425#M608080</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-09T19:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Add mapped column to already loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-mapped-column-to-already-loaded-table/m-p/81426#M608081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes you have to drop your result table after you created a mapping load. If not Qlik will try to create a relationship with both the tables as the column names are same. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do not want to drop the table for some reason, rename the one or both the columns in the result table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2018 20:08:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-mapped-column-to-already-loaded-table/m-p/81426#M608081</guid>
      <dc:creator>vamsee</dc:creator>
      <dc:date>2018-03-09T20:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Add mapped column to already loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-mapped-column-to-already-loaded-table/m-p/81427#M608082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you again for your help!&amp;nbsp; Renaming was the solution I needed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2018 20:11:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-mapped-column-to-already-loaded-table/m-p/81427#M608082</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-09T20:11:13Z</dc:date>
    </item>
  </channel>
</rss>

