<?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: Get the File with the Max Date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Get-the-File-with-the-Max-Date/m-p/611959#M1099766</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use filebasename() for this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Apr 2014 15:08:12 GMT</pubDate>
    <dc:creator>its_anandrjs</dc:creator>
    <dc:date>2014-04-23T15:08:12Z</dc:date>
    <item>
      <title>Get the File with the Max Date</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-File-with-the-Max-Date/m-p/611958#M1099765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a folder named Selections with many CSV files that have the following format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dime_DD_MM_YYYY_HH_MM_SS.csv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dime_01_04_2014_17_23_17.csv&lt;/P&gt;&lt;P&gt;Dime_02_04_2014_17_27_05.csv&lt;/P&gt;&lt;P&gt;Dime_03_04_2014_17_15_30.csv&lt;/P&gt;&lt;P&gt;Dime_03_04_2014_19_25_35.csv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need is to return the file that has the max date and then load the data into my model.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, the file would be: Dime_03_04_2014_19_25_35.csv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know how could I do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 15:03:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-File-with-the-Max-Date/m-p/611958#M1099765</guid>
      <dc:creator />
      <dc:date>2014-04-23T15:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Get the File with the Max Date</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-File-with-the-Max-Date/m-p/611959#M1099766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use filebasename() for this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 15:08:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-File-with-the-Max-Date/m-p/611959#M1099766</guid>
      <dc:creator>its_anandrjs</dc:creator>
      <dc:date>2014-04-23T15:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get the File with the Max Date</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-File-with-the-Max-Date/m-p/611960#M1099767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would perform:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Each file in the directory and process the dates from the filenames&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Then sort the table according to date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set a variable as the first record in the table using Peek&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Read the table from variable name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 15:14:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-File-with-the-Max-Date/m-p/611960#M1099767</guid>
      <dc:creator>Roop</dc:creator>
      <dc:date>2014-04-23T15:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Get the File with the Max Date</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-File-with-the-Max-Date/m-p/611961#M1099768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;see the attached file&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 15:25:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-File-with-the-Max-Date/m-p/611961#M1099768</guid>
      <dc:creator>bbi_mba_76</dc:creator>
      <dc:date>2014-04-23T15:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Get the File with the Max Date</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-File-with-the-Max-Date/m-p/611962#M1099769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Load your CSV file like the below code and every time the code runs it loads the latest file &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tab1:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;LOAD &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;FileBaseName() as filename,&lt;/P&gt;&lt;P&gt;Timestamp(Timestamp#(Right(FileBaseName(),19),'DD_MM_YYYY_hh_mm_ss'),'DD/MM/YYYY hh:mm:ss') as Date&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;Dime_*.csv //Put * here to load all file in folder&lt;/P&gt;&lt;P&gt;(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maxdate:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;MaxString(filename) as Mdate&lt;/P&gt;&lt;P&gt;Resident Tab1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vMaxFileName = peek('Mdate',-1,'Maxdate');&lt;/P&gt;&lt;P&gt;DROP Table Tab1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;New:&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;Dime_*.csv&lt;/P&gt;&lt;P&gt;(txt, codepage is 1252, embedded labels, delimiter is '\t', msq)&lt;/P&gt;&lt;P&gt;Where filename = $(vMaxFileName);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 15:52:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-File-with-the-Max-Date/m-p/611962#M1099769</guid>
      <dc:creator>its_anandrjs</dc:creator>
      <dc:date>2014-04-23T15:52:34Z</dc:date>
    </item>
  </channel>
</rss>

