<?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 Only load files between certain filetimes? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1973271#M1220636</link>
    <description>&lt;P&gt;I am working on a project in QlikView that needs to import text files from a folder. Within this folder, there are many subfolders organized by year and month.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, this folder has&amp;nbsp;&lt;STRONG&gt;many&lt;/STRONG&gt; years of data. 90% of this data I do not need. Instead, I want to be able to type in the dates I need and have QlikView return the files that have a filetime between those dates.&lt;/P&gt;
&lt;P&gt;The load works fine as it is, but it brings in everything, takes a long time, and I want to limit&amp;nbsp;&lt;SPAN&gt;it on the script side. Currently, I am prompting the user for the dates but not sure how to implement the date variables entered into an if statement for my load. Each time I try I get errors.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;______________________________________________________________________&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_b6d3b11.png" style="width: 782px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/87540iEA9DACB7AAC0C84E/image-dimensions/782x353?v=v2" width="782" height="353" role="button" title="Snag_b6d3b11.png" alt="Snag_b6d3b11.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My proposed solution would look something like this but it doesn't work. It gives and error "The control statement is not correctly matched with its corresponding start statement ..... next File":&lt;/P&gt;
&lt;P&gt;sub ScanFolder(Root)&lt;BR /&gt;for each Ext in 'txt'&lt;BR /&gt;for each File in filelist (Root &amp;amp; '\*.txt') &lt;BR /&gt;&lt;STRONG&gt;if FileTime([$(File)]) &amp;gt; vStartDt AND FileTime([$(File)]) &amp;lt; vEndDt then&lt;/STRONG&gt;&lt;BR /&gt;Data:&lt;BR /&gt;$(Concatenate)&lt;BR /&gt;LOAD [@1:50], &lt;BR /&gt;[@51:80], &lt;BR /&gt;[@81:97], &lt;BR /&gt;[@98:109], &lt;BR /&gt;[@110:n]&lt;BR /&gt;FROM [$(File)](fix, codepage is 28591, embedded labels);&lt;BR /&gt;set Concatenate = concatenate;&lt;BR /&gt;&lt;STRONG&gt;ELSE&lt;/STRONG&gt;&lt;BR /&gt;next File&lt;BR /&gt;next Ext&lt;BR /&gt;&lt;BR /&gt;for each SubDirectory in dirlist(Root&amp;amp;'\*')&lt;BR /&gt;call ScanFolder(SubDirectory)&lt;BR /&gt;next SubDirectory&lt;BR /&gt;&lt;BR /&gt;end sub&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Aug 2022 19:45:11 GMT</pubDate>
    <dc:creator>RJW</dc:creator>
    <dc:date>2022-08-25T19:45:11Z</dc:date>
    <item>
      <title>Only load files between certain filetimes?</title>
      <link>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1973271#M1220636</link>
      <description>&lt;P&gt;I am working on a project in QlikView that needs to import text files from a folder. Within this folder, there are many subfolders organized by year and month.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, this folder has&amp;nbsp;&lt;STRONG&gt;many&lt;/STRONG&gt; years of data. 90% of this data I do not need. Instead, I want to be able to type in the dates I need and have QlikView return the files that have a filetime between those dates.&lt;/P&gt;
&lt;P&gt;The load works fine as it is, but it brings in everything, takes a long time, and I want to limit&amp;nbsp;&lt;SPAN&gt;it on the script side. Currently, I am prompting the user for the dates but not sure how to implement the date variables entered into an if statement for my load. Each time I try I get errors.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;______________________________________________________________________&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_b6d3b11.png" style="width: 782px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/87540iEA9DACB7AAC0C84E/image-dimensions/782x353?v=v2" width="782" height="353" role="button" title="Snag_b6d3b11.png" alt="Snag_b6d3b11.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My proposed solution would look something like this but it doesn't work. It gives and error "The control statement is not correctly matched with its corresponding start statement ..... next File":&lt;/P&gt;
&lt;P&gt;sub ScanFolder(Root)&lt;BR /&gt;for each Ext in 'txt'&lt;BR /&gt;for each File in filelist (Root &amp;amp; '\*.txt') &lt;BR /&gt;&lt;STRONG&gt;if FileTime([$(File)]) &amp;gt; vStartDt AND FileTime([$(File)]) &amp;lt; vEndDt then&lt;/STRONG&gt;&lt;BR /&gt;Data:&lt;BR /&gt;$(Concatenate)&lt;BR /&gt;LOAD [@1:50], &lt;BR /&gt;[@51:80], &lt;BR /&gt;[@81:97], &lt;BR /&gt;[@98:109], &lt;BR /&gt;[@110:n]&lt;BR /&gt;FROM [$(File)](fix, codepage is 28591, embedded labels);&lt;BR /&gt;set Concatenate = concatenate;&lt;BR /&gt;&lt;STRONG&gt;ELSE&lt;/STRONG&gt;&lt;BR /&gt;next File&lt;BR /&gt;next Ext&lt;BR /&gt;&lt;BR /&gt;for each SubDirectory in dirlist(Root&amp;amp;'\*')&lt;BR /&gt;call ScanFolder(SubDirectory)&lt;BR /&gt;next SubDirectory&lt;BR /&gt;&lt;BR /&gt;end sub&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 19:45:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1973271#M1220636</guid>
      <dc:creator>RJW</dc:creator>
      <dc:date>2022-08-25T19:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Only load files between certain filetimes?</title>
      <link>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1973322#M1220639</link>
      <description>&lt;P&gt;Your ELSE statement should instead be an ENDIF statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Rob&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 22:10:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1973322#M1220639</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2022-08-25T22:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Only load files between certain filetimes?</title>
      <link>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1973325#M1220640</link>
      <description>&lt;P&gt;Could i æt be that your&amp;nbsp;&lt;STRONG&gt;FileTime([$(File)])&amp;nbsp;&lt;/STRONG&gt;expects a string as an parameter and not a field reference. Try changing to this:&amp;nbsp;&lt;STRONG&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/Scripting/FileFunctions/FileTime.htm" target="_self"&gt;FileTime&lt;/A&gt;('$(File)')&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 22:28:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1973325#M1220640</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2022-08-25T22:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Only load files between certain filetimes?</title>
      <link>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1973763#M1220665</link>
      <description>&lt;P&gt;Hi Rob, thanks. I made this change and now I get no errors when running the script!&lt;/P&gt;
&lt;P&gt;However, now, it does not return any data. I know that the files exist with parameters I am typing in.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 18:11:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1973763#M1220665</guid>
      <dc:creator>RJW</dc:creator>
      <dc:date>2022-08-26T18:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Only load files between certain filetimes?</title>
      <link>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1973766#M1220666</link>
      <description>&lt;P&gt;Hi Vegar,&lt;/P&gt;
&lt;P&gt;Qlik seems to like this change, but I am not returning any data. In the parameters I am typing in 07/22/2022 as the&amp;nbsp;&lt;STRONG&gt;vStartDt&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;and 08/18/2022 as the &lt;STRONG&gt;vEndDt&amp;nbsp;&lt;/STRONG&gt;and expecting to get all text files from the directory that have been saved in that date range.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 18:15:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1973766#M1220666</guid>
      <dc:creator>RJW</dc:creator>
      <dc:date>2022-08-26T18:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: Only load files between certain filetimes?</title>
      <link>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1974905#M1220697</link>
      <description>&lt;P&gt;SOLVED: Needed to match the FileTime date format with the variable date format. The FileTime format included hh:mm:ss and the variable did not.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The input now reads:&lt;/P&gt;
&lt;P&gt;LET vStartDt = Date(Input('Enter the last close date in MM/DD/YYYY format.', 'Please answer the following prompt.'),'MM/DD/YYYY hh:mm;ss');&lt;BR /&gt;LET vEndDt = Date(Input('Enter the most recent close date in MM/DD/YYYY format.', 'Please answer the following prompt.'), 'MM/DD/YYYY hh:mm;ss');&lt;/P&gt;
&lt;P&gt;And, from there, the code returns the desired files within those dates. The code also includes the solutions suggested from&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/25001"&gt;@Vegar&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6148"&gt;@rwunderlich&lt;/a&gt; to help with the IF statement.&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 14:43:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-load-files-between-certain-filetimes/m-p/1974905#M1220697</guid>
      <dc:creator>RJW</dc:creator>
      <dc:date>2022-08-30T14:43:18Z</dc:date>
    </item>
  </channel>
</rss>

