<?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: Load only the two latest files in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1738117#M721806</link>
    <description>&lt;P&gt;you can add one variable as highlighted below in part of the code&lt;/P&gt;&lt;P&gt;for i=1 to FieldValueCount('Month')&lt;/P&gt;&lt;P&gt;let&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;vFilePath&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;= FieldValue('Path',$(i));&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;let&amp;nbsp;vMonth&amp;nbsp;= FieldValue('Month',$(i));&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Concatenate(Data)&lt;BR /&gt;LOAD *,&lt;BR /&gt;FileBaseName() as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;FileName,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;'$(vMonth)' as MONTH&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;FROM&lt;BR /&gt;&lt;EM&gt;[$(vFilePath)]&lt;/EM&gt;&lt;BR /&gt;&lt;STRONG&gt;(ooxml, embedded labels, table is Sheet1)&lt;/STRONG&gt;; // you can change this highlighted part as you may have different way of loading the excel files&lt;/P&gt;</description>
    <pubDate>Mon, 24 Aug 2020 11:47:25 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2020-08-24T11:47:25Z</dc:date>
    <item>
      <title>Load only the two latest files</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1736316#M721796</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have files ( All of them are in the same format) named as for example 'REAL_1008' and the '1008' is the date as the 10th of August.&amp;nbsp; I want only load the two latest fles based on that date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me please ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1736316#M721796</guid>
      <dc:creator>KaisGarci</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Load only the two latest files</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1736330#M721797</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;take this:&lt;/P&gt;&lt;P&gt;for each vFile in filelist('YourPath\REAL_*')&lt;/P&gt;&lt;P&gt;Files:&lt;/P&gt;&lt;P&gt;load&amp;nbsp;&lt;/P&gt;&lt;P&gt;'$(vFile)' as File,&lt;/P&gt;&lt;P&gt;filetime() as Timestamp&lt;/P&gt;&lt;P&gt;autogenerate (1);&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;Files_Sorted:&lt;/P&gt;&lt;P&gt;noconcatenate load * resident Files order by Timestamp DESC;&lt;/P&gt;&lt;P&gt;drop table Files;&lt;/P&gt;&lt;P&gt;for vLoadfiles = 0 to 1&lt;/P&gt;&lt;P&gt;let vLoadfile = peek('File'),$(vLoadfiles),'Files_Sorted)';&lt;/P&gt;&lt;P&gt;load *&lt;/P&gt;&lt;P&gt;from, '$(vLoadfile )'&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;drop table Files_Sorted;&lt;/P&gt;&lt;P&gt;I would take filetime instead of numbers in filename because there is no year in.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 11:24:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1736330#M721797</guid>
      <dc:creator>martinpohl</dc:creator>
      <dc:date>2020-08-17T11:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Load only the two latest files</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1736353#M721798</link>
      <description>&lt;P&gt;Thank you for helping me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it didn't work.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 605px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/39114i457272A8486A2526/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.PNG" style="width: 350px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/39112iFF5E53C762DD1C55/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.PNG" alt="Capture1.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.PNG" style="width: 558px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/39113iE6AA2510D35338B2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture2.PNG" alt="Capture2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 11:51:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1736353#M721798</guid>
      <dc:creator>KaisGarci</dc:creator>
      <dc:date>2020-08-17T11:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Load only the two latest files</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1736356#M721799</link>
      <description>&lt;P&gt;there is a script error&lt;/P&gt;&lt;P&gt;change&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;let vLoadfile = peek('File'),$(vLoadfiles),'Files_Sorted)';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;let vLoadfile = peek('File'),$(vLoadfiles),'Files_Sorted';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 11:55:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1736356#M721799</guid>
      <dc:creator>martinpohl</dc:creator>
      <dc:date>2020-08-17T11:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Load only the two latest files</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1737713#M721800</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28859"&gt;@martinpohl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for helping but it still give an error.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 11:27:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1737713#M721800</guid>
      <dc:creator>KaisGarci</dc:creator>
      <dc:date>2020-08-21T11:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Load only the two latest files</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1737716#M721802</link>
      <description>&lt;P&gt;&lt;SPAN&gt;let vLoadfile = peek('File',$(vLoadfiles),'Files_Sorted');&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 11:33:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1737716#M721802</guid>
      <dc:creator>martinpohl</dc:creator>
      <dc:date>2020-08-21T11:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: Load only the two latest files</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1737737#M721803</link>
      <description>&lt;P&gt;It load but it gives me an empty table&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 11:54:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1737737#M721803</guid>
      <dc:creator>KaisGarci</dc:creator>
      <dc:date>2020-08-21T11:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Load only the two latest files</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1737755#M721804</link>
      <description>&lt;P&gt;try below.&amp;nbsp; Change the path as per your folder location&lt;/P&gt;&lt;P&gt;for Each vFile in FileList(&lt;STRONG&gt;'C:\REAL_*.xlsx'&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;Files:&lt;BR /&gt;LOAD subfield('$(vFile)','\',-1) as FileName,&lt;BR /&gt;date(date#(mid('$(vFile)',index('$(vFile)','_',-1)+1,4),'DDMM')) as Month,&lt;BR /&gt;'$(vFile)' as Path&lt;BR /&gt;AutoGenerate 1;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;Files_needed:&lt;BR /&gt;NoConcatenate&lt;BR /&gt;first 2 LOAD *&lt;BR /&gt;Resident Files&lt;BR /&gt;Order by Month desc;&lt;/P&gt;&lt;P&gt;DROP Table Files;&lt;/P&gt;&lt;P&gt;Data:&lt;BR /&gt;LOAD * Inline [&lt;BR /&gt;Temp ];&lt;/P&gt;&lt;P&gt;for i=1 to FieldValueCount('Month')&lt;/P&gt;&lt;P&gt;let &lt;STRONG&gt;vFilePath&lt;/STRONG&gt; = FieldValue('Path',$(i));&lt;/P&gt;&lt;P&gt;Concatenate(Data)&lt;BR /&gt;LOAD *,&lt;BR /&gt;FileBaseName() as &lt;STRONG&gt;FileName&lt;/STRONG&gt;&lt;BR /&gt;FROM&lt;BR /&gt;&lt;EM&gt;[$(vFilePath)]&lt;/EM&gt;&lt;BR /&gt;&lt;STRONG&gt;(ooxml, embedded labels, table is Sheet1)&lt;/STRONG&gt;; // you can change this highlighted part as you may have different way of loading the excel files&lt;/P&gt;&lt;P&gt;NEXT&lt;/P&gt;&lt;P&gt;DROP Table Files_needed;&lt;/P&gt;&lt;P&gt;DROP Field Temp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 13:36:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1737755#M721804</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-08-24T13:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Load only the two latest files</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1738110#M721805</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt; . this worked perfectly, but I want to add a variable called date which gives me the date of the 2 latest file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 11:32:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1738110#M721805</guid>
      <dc:creator>KaisGarci</dc:creator>
      <dc:date>2020-08-24T11:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Load only the two latest files</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1738117#M721806</link>
      <description>&lt;P&gt;you can add one variable as highlighted below in part of the code&lt;/P&gt;&lt;P&gt;for i=1 to FieldValueCount('Month')&lt;/P&gt;&lt;P&gt;let&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;vFilePath&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;= FieldValue('Path',$(i));&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;let&amp;nbsp;vMonth&amp;nbsp;= FieldValue('Month',$(i));&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Concatenate(Data)&lt;BR /&gt;LOAD *,&lt;BR /&gt;FileBaseName() as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;FileName,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;'$(vMonth)' as MONTH&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;FROM&lt;BR /&gt;&lt;EM&gt;[$(vFilePath)]&lt;/EM&gt;&lt;BR /&gt;&lt;STRONG&gt;(ooxml, embedded labels, table is Sheet1)&lt;/STRONG&gt;; // you can change this highlighted part as you may have different way of loading the excel files&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 11:47:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1738117#M721806</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-08-24T11:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Load only the two latest files</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1738141#M721808</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;. This was really helpfull. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 13:00:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-the-two-latest-files/m-p/1738141#M721808</guid>
      <dc:creator>KaisGarci</dc:creator>
      <dc:date>2020-08-24T13:00:02Z</dc:date>
    </item>
  </channel>
</rss>

