<?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 Add a new column to a loaded table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192559#M715371</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If ABC doesn't have a unique key, you can do this:&lt;/P&gt;&lt;P&gt;LEFT JOIN ([ABC])&lt;/P&gt;&lt;P&gt;LOAD FieldA&lt;/P&gt;&lt;P&gt;, FieldB&lt;/P&gt;&lt;P&gt;, FieldA &amp;amp; FieldB AS FieldC&lt;/P&gt;&lt;P&gt;RESIDENT ABC&lt;/P&gt;&lt;P&gt;GROUP BY FieldA, FieldB;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Apr 2010 22:04:40 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-04-06T22:04:40Z</dc:date>
    <item>
      <title>Add a new column to a loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192554#M715366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am loading data in tables from QVD files and I want to add a new column, which will be a concatenation of two columns in the same table.&lt;/P&gt;&lt;P&gt;Can someone suggest how to accomplish this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET LoadTables='ABC','XYZ','PQR';&lt;/P&gt;&lt;P&gt;FOR EACH Table in $(LoadTables)&lt;/P&gt;&lt;P&gt;$(Table): LOAD * FROM $(Table).qvd (qvd);&lt;/P&gt;&lt;P&gt;NEXT&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I want to add a new column in first table (ABC).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Mar 2010 15:42:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192554#M715366</guid>
      <dc:creator />
      <dc:date>2010-03-24T15:42:01Z</dc:date>
    </item>
    <item>
      <title>Add a new column to a loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192555#M715367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, since you are doing this with FOR loop iterations, I don't think it's possible (unless of course you want to do the same thing for each table). But if you had just one table, ABC for example, you can do it with a preceding load like this:&lt;/P&gt;&lt;P&gt;ABC:&lt;BR /&gt;LOAD&lt;BR /&gt; *,&lt;BR /&gt; FieldA &amp;amp; FieldB as Field C&lt;BR /&gt;;&lt;BR /&gt;LOAD&lt;BR /&gt; *&lt;BR /&gt;FROM ABC.qvd (qvd);&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Mar 2010 15:49:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192555#M715367</guid>
      <dc:creator>vgutkovsky</dc:creator>
      <dc:date>2010-03-24T15:49:25Z</dc:date>
    </item>
    <item>
      <title>Add a new column to a loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192556#M715368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vlad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for replying.&lt;/P&gt;&lt;P&gt;I want to add the column in one of the tables only (say ABC) after the for loop.&lt;/P&gt;&lt;P&gt;After the loop exits, I know that I have a table loaded with the name ABC. Is there a way to do it in an already loaded table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Mar 2010 15:55:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192556#M715368</guid>
      <dc:creator />
      <dc:date>2010-03-24T15:55:12Z</dc:date>
    </item>
    <item>
      <title>Add a new column to a loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192557#M715369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure. You can do it like this (after the for loop).&lt;/P&gt;&lt;P&gt;ABC2:&lt;BR /&gt;LOAD&lt;BR /&gt; *,&lt;BR /&gt; FieldA &amp;amp; FieldB as FieldC&lt;BR /&gt;RESIDENT ABC;&lt;/P&gt;&lt;P&gt;drop table ABC;&lt;BR /&gt;rename table ABC2 to ABC;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Mar 2010 16:15:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192557#M715369</guid>
      <dc:creator>vgutkovsky</dc:creator>
      <dc:date>2010-03-24T16:15:49Z</dc:date>
    </item>
    <item>
      <title>Add a new column to a loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192558#M715370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the table has a unique key, you can save some memory and possibly time by not creating a temporary duplicate table:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;LEFT JOIN ([ABC])&lt;BR /&gt;LOAD&lt;BR /&gt; "Unique Key of ABC"&lt;BR /&gt;,FieldA &amp;amp; FieldB as FieldC&lt;BR /&gt;RESIDENT ABC&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Also, if you go with the duplicate table approach, you'll probably need to do a NOCONCATENATE LOAD.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Mar 2010 19:52:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192558#M715370</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-03-24T19:52:35Z</dc:date>
    </item>
    <item>
      <title>Add a new column to a loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192559#M715371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If ABC doesn't have a unique key, you can do this:&lt;/P&gt;&lt;P&gt;LEFT JOIN ([ABC])&lt;/P&gt;&lt;P&gt;LOAD FieldA&lt;/P&gt;&lt;P&gt;, FieldB&lt;/P&gt;&lt;P&gt;, FieldA &amp;amp; FieldB AS FieldC&lt;/P&gt;&lt;P&gt;RESIDENT ABC&lt;/P&gt;&lt;P&gt;GROUP BY FieldA, FieldB;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 22:04:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192559#M715371</guid>
      <dc:creator />
      <dc:date>2010-04-06T22:04:40Z</dc:date>
    </item>
    <item>
      <title>Add a new column to a loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192560#M715372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ddonia: may I ask why u use a group by clause in your example?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 23:33:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192560#M715372</guid>
      <dc:creator>blaise</dc:creator>
      <dc:date>2010-04-06T23:33:24Z</dc:date>
    </item>
    <item>
      <title>Add a new column to a loaded table</title>
      <link>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192561#M715373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;blaise wrote:ddonia: may I ask why u use a group by clause in your example?&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;If you don't do the group by, you can get create duplicate rows in the left join. Consider this table. The unique key of Row has been added merely for illustrative purposes. We won't be using it directly.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Row, FieldA, FieldB&lt;BR /&gt;1, X, Y&lt;BR /&gt;2, X, Y&lt;/P&gt;&lt;P&gt;If you do the left join without the group by, Row 1 will match both Row 1 and Row 2. Row 2 will match both Row 1 and Row 2. You end up with this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Row, FieldA, FieldB, FieldC&lt;BR /&gt;1, X, Y, XY&lt;BR /&gt;1, X, Y, XY&lt;BR /&gt;2, X, Y, XY&lt;BR /&gt;2, X, Y, XY&lt;/P&gt;&lt;P&gt;That almost certainly isn't what you want. I make this or similar join mistakes with alarming frequency even though I should know better by now. At least I recognize the symptoms a lot faster these days, "Oh, messed up my join". One way I check for it is that most of my tables DO have a unique key. If that key is only in that one table, and a count of that key is different from a count distinct of that key, I know I messed up my table. You can also sometimes watch it happen in the log, with a table increasing in rows when it shouldn't be.&lt;/P&gt;&lt;P&gt;The group by prevents this from happening, because it will only join one copy of the (X, Y, XY) row, giving you what you wanted:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Row, FieldA, FieldB, FieldC&lt;BR /&gt;1, X, Y, XY&lt;BR /&gt;2, X, Y, XY&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Apr 2010 00:06:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-a-new-column-to-a-loaded-table/m-p/192561#M715373</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-04-07T00:06:18Z</dc:date>
    </item>
  </channel>
</rss>

