<?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 Create Empty Table for a Looping Load in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Create-Empty-Table-for-a-Looping-Load/m-p/1087311#M634548</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is common to load from a set to files using a loop like a ForEach over a FileList. If the files are not identical, you need to explicitly concatenate them, but you cannot use concatenate in the first iteration of the loop as the table does not exist yet. One common solution is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;Set vTable = ‘MyTable:’;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;For ......&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; $(vTable)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; LOAD ……&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; Set vTable = ‘Concatenate(MyTable)’;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;Next&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and clean up the variable at the end of the load:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;Set vTable = ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is another way that I prefer. Create an empty table before the loop. Like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;MyTable:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;LOAD 0 as ID AutoGenerate 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;For ......&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; Concatenate(MyTable))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; LOAD ……&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;Next&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;(Use a field that is in the main load inside the loop - ID in this example).&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;AutoGenerate 0 creates an empty table. The other columns are added as required by the loads in the loop. There is no clean up necessary and the syntax checker is not confused by the embedded variable.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 May 2016 07:57:14 GMT</pubDate>
    <dc:creator>jonathandienst</dc:creator>
    <dc:date>2016-05-06T07:57:14Z</dc:date>
    <item>
      <title>Create Empty Table for a Looping Load</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Empty-Table-for-a-Looping-Load/m-p/1087311#M634548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is common to load from a set to files using a loop like a ForEach over a FileList. If the files are not identical, you need to explicitly concatenate them, but you cannot use concatenate in the first iteration of the loop as the table does not exist yet. One common solution is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;Set vTable = ‘MyTable:’;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;For ......&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; $(vTable)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; LOAD ……&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; Set vTable = ‘Concatenate(MyTable)’;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;Next&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and clean up the variable at the end of the load:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;Set vTable = ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is another way that I prefer. Create an empty table before the loop. Like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;MyTable:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;LOAD 0 as ID AutoGenerate 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;For ......&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; Concatenate(MyTable))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; LOAD ……&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;Next&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Lucida Console'; color: #c0504d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;(Use a field that is in the main load inside the loop - ID in this example).&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;AutoGenerate 0 creates an empty table. The other columns are added as required by the loads in the loop. There is no clean up necessary and the syntax checker is not confused by the embedded variable.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2016 07:57:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Empty-Table-for-a-Looping-Load/m-p/1087311#M634548</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2016-05-06T07:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create Empty Table for a Looping Load</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Empty-Table-for-a-Looping-Load/m-p/1087312#M634549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for sharing this &lt;A _jive_internal="true" href="https://community.qlik.com/people/jontydkpi"&gt;Jonathan&lt;/A&gt;‌. I have been using this a lot lately whereas earlier I used to be scared using loops in these situations when I did not know about creating a table using AutoGenerate 0. I actually picked this technique from some of the responses from &lt;A href="https://community.qlik.com/qlik-users/23109"&gt;jagan&lt;/A&gt;‌.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And just to add this also works for Joins aswell, the only thing is that within the loop you need to have a field on which you can join on, else join would work just as concatenate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2016 08:48:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Empty-Table-for-a-Looping-Load/m-p/1087312#M634549</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-06T08:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: Create Empty Table for a Looping Load</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Empty-Table-for-a-Looping-Load/m-p/1087313#M634550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, good trick. I reckon a lot of experienced users use this. But it's a good idea to share such techniques with the community. Keep 'm coming.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2016 08:53:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Empty-Table-for-a-Looping-Load/m-p/1087313#M634550</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-05-06T08:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create Empty Table for a Looping Load</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Empty-Table-for-a-Looping-Load/m-p/1087314#M634551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been using the same in many applications. Some times I also used inline load like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;LOAD * inline [&lt;/P&gt;&lt;P&gt;Junk ];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2016 09:03:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Empty-Table-for-a-Looping-Load/m-p/1087314#M634551</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2016-05-06T09:03:43Z</dc:date>
    </item>
  </channel>
</rss>

