<?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 Loop read in using sequential filenames in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loop-read-in-using-sequential-filenames/m-p/185325#M1327839</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;BR /&gt;I'm sure that the simpler way will work, no need for the FileName varable:&lt;BR /&gt;LOAD&lt;BR /&gt;...&lt;BR /&gt;FROM &lt;A&gt;\\PATH\datafiles\&lt;STRONG&gt;MyFile_$(a)&lt;/STRONG&gt;.csv&lt;/A&gt; ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Mar 2011 18:51:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-03-30T18:51:17Z</dc:date>
    <item>
      <title>Loop read in using sequential filenames</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-read-in-using-sequential-filenames/m-p/185323#M1327829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Team,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am attempting to create an automatic load which will count the number of files in a folder and then read in each of those files using a FOR/NEXT loop, and sequential filenames (eg. MyFile_1, MyFile_2, etc...).&lt;/P&gt;&lt;P&gt;There is one section of the code that does appear to work. The count of the filenames returns the correct value for "n", however the line of code struck out below in which I attempt to set a macro equal to the value of the field "n" will not work (this is needed so that I can end my loop at $(N) which would equal the final "MyFile_x").&lt;/P&gt;&lt;P&gt;If anyone can provide any insight on how I can accomplish that goal it would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET N=0;&lt;/P&gt;&lt;P&gt;filenames:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;Filename() as filename&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[\\PATH\datafiles\*.csv]&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;load count(DISTINCT(filename)) as n&lt;/P&gt;&lt;P&gt;resident filenames;&lt;/P&gt;&lt;P&gt;load n,&lt;/P&gt;&lt;P&gt;&lt;S&gt;$(N)=sum(n)&lt;/S&gt;&lt;/P&gt;&lt;P&gt;resident [filenames-1];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR a = 2 to $(N);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let FileName = [\\PATH\datafiles\MyFile_$(a).csv]'; // FileName is a variable representing the csv file name aka MyFile_1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fact_Pre:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;$(FileName)&lt;/P&gt;&lt;P&gt;(txt, codepage is 1252, embedded labels, delimiter is ',', msq);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2026 18:19:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-read-in-using-sequential-filenames/m-p/185323#M1327829</guid>
      <dc:creator />
      <dc:date>2026-01-26T18:19:17Z</dc:date>
    </item>
    <item>
      <title>AW:Loop read in using sequential filenames</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-read-in-using-sequential-filenames/m-p/185324#M1327833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Michael,&lt;/P&gt;&lt;P&gt;as far as I understand you I would try a "for each in filelist" instead of a for-loop (similar to the code below):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;for each File in filelist ([\\PATH\datafiles\*.csv]) // or [\\PATH\datafiles\MyFile_*.csv]&lt;BR /&gt;LOAD&lt;BR /&gt; *&lt;BR /&gt;From&lt;BR /&gt;$(File) (txt, codepage is 1252, no labels, delimiter is '\t', msq);&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Roland&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 18:51:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-read-in-using-sequential-filenames/m-p/185324#M1327833</guid>
      <dc:creator />
      <dc:date>2011-03-30T18:51:05Z</dc:date>
    </item>
    <item>
      <title>Loop read in using sequential filenames</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-read-in-using-sequential-filenames/m-p/185325#M1327839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;BR /&gt;I'm sure that the simpler way will work, no need for the FileName varable:&lt;BR /&gt;LOAD&lt;BR /&gt;...&lt;BR /&gt;FROM &lt;A&gt;\\PATH\datafiles\&lt;STRONG&gt;MyFile_$(a)&lt;/STRONG&gt;.csv&lt;/A&gt; ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 18:51:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-read-in-using-sequential-filenames/m-p/185325#M1327839</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-03-30T18:51:17Z</dc:date>
    </item>
    <item>
      <title>AW:Loop read in using sequential filenames</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-read-in-using-sequential-filenames/m-p/185326#M1327843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, even simpler from Ronald&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 18:54:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-read-in-using-sequential-filenames/m-p/185326#M1327843</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-03-30T18:54:11Z</dc:date>
    </item>
  </channel>
</rss>

