<?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: Loop within Load script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Loop-within-Load-script/m-p/2090796#M89411</link>
    <description>&lt;P&gt;Apologies for not&amp;nbsp; explaining my self enough, the issue here is not how to concatenate&amp;nbsp; two tables since each subsequent table (excel file) contains all the data of the previous tables .&lt;/P&gt;
&lt;P&gt;The purpose of the script is to load specific columns (emp_no, Department, Salary Date) and all other columns starting from column number 7 to column number N.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jul 2023 16:30:20 GMT</pubDate>
    <dc:creator>Sharbel</dc:creator>
    <dc:date>2023-07-05T16:30:20Z</dc:date>
    <item>
      <title>Loop within Load script</title>
      <link>https://community.qlik.com/t5/App-Development/Loop-within-Load-script/m-p/2090693#M89402</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am trying to load salary data from excel files on monthly basis. Each excel file has data regarding&amp;nbsp; specific month as seen in sample tables below :&lt;/P&gt;
&lt;P&gt;&lt;U&gt;May 2023:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sharbel_0-1688555609846.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/111609i7CC034203D72CF1D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Sharbel_0-1688555609846.png" alt="Sharbel_0-1688555609846.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;June 2023:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sharbel_1-1688555695962.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/111610i85324B60F25C387B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Sharbel_1-1688555695962.png" alt="Sharbel_1-1688555695962.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Since the number of columns vary from month to month&lt;/STRONG&gt; , I used loop within the Load script as follows:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Table_temp:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;FROM [may2023.xlsx];&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Let NumberOfColumns = NoOfFields('Table_temp');&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;For i = 7 to NumberOfColumns&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Let FieldName = FieldName(i,'Table_temp');&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Load&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;emp_no,&lt;/P&gt;
&lt;P&gt;Depatment,&lt;/P&gt;
&lt;P&gt;Salary_Date,&lt;/P&gt;
&lt;P&gt;$(FieldName)&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Resident Table_temp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Next;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;drop Table Table_temp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above script is supposed to&amp;nbsp; load the columns emp_no, Department,Salary_Date and all other columns starting from column number 7 to the number of columns in each table (that vary from month to month).&lt;/P&gt;
&lt;P&gt;When i ran the above script (for example in month of May 2023), what i actually got was several tables (4 tables) , each table has the same first 3 columns (i.e emp_no, Department,Salary_Date) and another column from the table of May2023, and that's not the desired outcome that i wanted in the first place.&lt;/P&gt;
&lt;P&gt;The desired outcome for May2033 would be a single table consists of the following columns:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sharbel_2-1688558005371.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/111612iB762DA6C964A427C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Sharbel_2-1688558005371.png" alt="Sharbel_2-1688558005371.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Any ideas on how to fix the above script ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks,&lt;/P&gt;
&lt;P&gt;Sharbel&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;&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 11:54:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Loop-within-Load-script/m-p/2090693#M89402</guid>
      <dc:creator>Sharbel</dc:creator>
      <dc:date>2023-07-05T11:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Loop within Load script</title>
      <link>https://community.qlik.com/t5/App-Development/Loop-within-Load-script/m-p/2090721#M89405</link>
      <description>&lt;P&gt;Only tables with the identically data-structure would be auto-concatenated into a single table. To enforce different structures form multiple loads into a single table you may use the load-prefix NoConcatenate.&lt;/P&gt;
&lt;P&gt;Personally I wouldn't do it in your case else transforming the crosstable-structures into normal records, maybe with a logic like:&lt;/P&gt;
&lt;P&gt;for each file in filelist()&lt;BR /&gt;&amp;nbsp; &amp;nbsp;t: crosstable(Type, Value, 6) load * from Source;&lt;BR /&gt;next&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 13:03:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Loop-within-Load-script/m-p/2090721#M89405</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-07-05T13:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Loop within Load script</title>
      <link>https://community.qlik.com/t5/App-Development/Loop-within-Load-script/m-p/2090796#M89411</link>
      <description>&lt;P&gt;Apologies for not&amp;nbsp; explaining my self enough, the issue here is not how to concatenate&amp;nbsp; two tables since each subsequent table (excel file) contains all the data of the previous tables .&lt;/P&gt;
&lt;P&gt;The purpose of the script is to load specific columns (emp_no, Department, Salary Date) and all other columns starting from column number 7 to column number N.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 16:30:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Loop-within-Load-script/m-p/2090796#M89411</guid>
      <dc:creator>Sharbel</dc:creator>
      <dc:date>2023-07-05T16:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Loop within Load script</title>
      <link>https://community.qlik.com/t5/App-Development/Loop-within-Load-script/m-p/2090905#M89417</link>
      <description>&lt;P&gt;I suggest just to drop the unwanted 3 fields after load-loop because it's the most simple approach and avoids any complexity of accessing the files in beforehand of the real data-load to get the information which fields are there.&lt;/P&gt;
&lt;P&gt;Further I would assume that loading all fields and removing the unwanted ones afterwards isn't less performant against the extra efforts to get the field-information in beforehand. Also I suggest to transform the crosstable because it simplifies the handling significantly.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 05:54:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Loop-within-Load-script/m-p/2090905#M89417</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-07-06T05:54:47Z</dc:date>
    </item>
  </channel>
</rss>

