<?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 last CSV file of floder in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510331#M600219</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;This old answer can help you&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/QlikView-Scripting/Only-load-latest-file/m-p/671638/highlight/true#M42955" target="_blank"&gt;https://community.qlik.com/t5/QlikView-Scripting/Only-load-latest-file/m-p/671638/highlight/true#M42955&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Nov 2018 11:42:50 GMT</pubDate>
    <dc:creator>jcarloscandela</dc:creator>
    <dc:date>2018-11-21T11:42:50Z</dc:date>
    <item>
      <title>Load only last CSV file of floder</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510304#M600218</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have multiple CSV file in my folder. The name of CSV file is like that :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;20181125 -product-extract&lt;/P&gt;&lt;P&gt;20180820-product-extract&lt;/P&gt;&lt;P&gt;20180910-product-extract&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I have a script and i want to load only last CSV file, but i would like to know how can i do this ?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 11:01:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510304#M600218</guid>
      <dc:creator>jmialoundama</dc:creator>
      <dc:date>2018-11-21T11:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Load only last CSV file of floder</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510331#M600219</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;This old answer can help you&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/QlikView-Scripting/Only-load-latest-file/m-p/671638/highlight/true#M42955" target="_blank"&gt;https://community.qlik.com/t5/QlikView-Scripting/Only-load-latest-file/m-p/671638/highlight/true#M42955&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 11:42:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510331#M600219</guid>
      <dc:creator>jcarloscandela</dc:creator>
      <dc:date>2018-11-21T11:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Load only last CSV file of floder</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510334#M600220</link>
      <description>&lt;P&gt;Here it is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For each vFile in FileList('lib://YOUR_PATH/*.csv')&lt;/P&gt;&lt;P&gt;LET vFileName = SubField('$(vFile)','/',-1);&lt;/P&gt;&lt;P&gt;LET vDate = Date(Date#(Left('$(vFileName)',8),'YYYYMMDD'),'YYYYMMDD');&lt;/P&gt;&lt;P&gt;tmpFiles:&lt;/P&gt;&lt;P&gt;LOAD '$(vFile)' as File, '$(vFileName)' as FileName, '$(vDate)' as Date AutoGenerate 1;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;Files:&lt;/P&gt;&lt;P&gt;LOAD Max(Date) as Date RESIDENT tmpFiles;&lt;/P&gt;&lt;P&gt;LEFT JOIN (Files)&lt;/P&gt;&lt;P&gt;LOAD File, Date RESIDENT tmpFiles;&lt;/P&gt;&lt;P&gt;DROP TABLE tmpFiles;&lt;/P&gt;&lt;P&gt;For i = 0 to NoOfRows('Files') -1&lt;/P&gt;&lt;P&gt;LET vSourceFile = peek('File',$(i),'Files');&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt;LOAD * FROM [$(vSourceFile)] (csv);&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 11:45:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510334#M600220</guid>
      <dc:creator>Thiago_Justen_</dc:creator>
      <dc:date>2018-11-21T11:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: Load only last CSV file of floder</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510336#M600221</link>
      <description>&lt;P&gt;Hello Thiago,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks you for your aswer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try this script ,but it's not works and i didn't see where error can provide :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I&amp;nbsp; have multiple csv file like this :&amp;nbsp;&lt;/P&gt;&lt;P&gt;20181120-product-extract.csv&lt;/P&gt;&lt;P&gt;20180805-product-extract.csv&lt;/P&gt;&lt;P&gt;20180901-product-extract.csv&lt;/P&gt;&lt;P&gt;I want to load only last csv file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to applicate this script to load lastest CSV file , but it's not working and i can't to see my error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I update the script like this&amp;nbsp; :&amp;nbsp;&lt;/P&gt;&lt;P&gt;LET vFilePath = 'lib://AttachedFiles/*-product-extract.csv';&lt;BR /&gt;FOR EACH file in FileList('$(vFilePath)'); // Loops each excel file in the given Folder&lt;BR /&gt;LET vFileDate = Date((Left(file,8)); // Gets the year portion from the filename&lt;BR /&gt;LET vMaxDate = Rangemax(vFileDate, vMaxDate); // Gets the max year for every iteration&lt;BR /&gt;NEXT&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Data:&lt;BR /&gt;LOAD sku&lt;BR /&gt;FROM [lib://AttachedFiles/$(vMaxDate)-product-extract.csv]&lt;BR /&gt;(txt, utf8, embedded labels, delimiter is '|', msq);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Error : "Cannot open file 'lib://AttachedFiles/-product-extract.csv'&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 11:48:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510336#M600221</guid>
      <dc:creator>jmialoundama</dc:creator>
      <dc:date>2018-11-21T11:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Load only last CSV file of floder</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510343#M600222</link>
      <description>&lt;P&gt;Thiago,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try your script and i have same error :&amp;nbsp;Cannot open file: 'lib://AttachedFiles/lib://AttachedFiles/20181118-product-extract.csv-product-extract.csv'&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 11:56:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510343#M600222</guid>
      <dc:creator>jmialoundama</dc:creator>
      <dc:date>2018-11-21T11:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: Load only last CSV file of floder</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510355#M600223</link>
      <description>&lt;P&gt;Change this piece of code:&lt;/P&gt;&lt;P&gt;From:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LET vFilePath = 'lib://AttachedFiles/*-product-extract.csv';&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LET vFilePath = 'lib://AttachedFiles/*.csv';&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 12:06:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510355#M600223</guid>
      <dc:creator>Thiago_Justen_</dc:creator>
      <dc:date>2018-11-21T12:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Load only last CSV file of floder</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510403#M600224</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I solded my problem. I update script like this and it's works :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;LET vFilePath ='lib://AttachedFiles';&lt;BR /&gt;FOR EACH file in FileList('$(vFilePath)/*.csv'); // Loops each excel file in the given Folder&lt;BR /&gt;LET vFileDate = Date(Left(right(file,28),8)); // Gets the year portion from the filename&lt;BR /&gt;LET vMaxDate = Rangemax(vFileDate, vMaxDate); // Gets the max year for every iteration&lt;BR /&gt;NEXT&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Data:&lt;BR /&gt;LOAD *&lt;BR /&gt;FROM [$(vFilePath)/$(vMaxDate)-product-extract.csv]&lt;BR /&gt;(txt, utf8, embedded labels, delimiter is '|', msq);&lt;/PRE&gt;&lt;P&gt;With this script i get the latest csv file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks your for your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 12:58:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510403#M600224</guid>
      <dc:creator>jmialoundama</dc:creator>
      <dc:date>2018-11-21T12:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Load only last CSV file of floder</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510408#M600225</link>
      <description>&lt;P&gt;Sound good. If&amp;nbsp;my responses were useful, please give&amp;nbsp;like&amp;nbsp;to those.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 13:05:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-last-CSV-file-of-floder/m-p/1510408#M600225</guid>
      <dc:creator>Thiago_Justen_</dc:creator>
      <dc:date>2018-11-21T13:05:14Z</dc:date>
    </item>
  </channel>
</rss>

