<?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: Loading data based on modified file time in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loading-data-based-on-modified-file-time/m-p/696376#M251577</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You meant TM1 did a rename from all log-files each time there is a new one - possibly thousands of files every xx minutes? There are none better settings possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you are right with the assumption that qv always evaluates the complete load-statement and file-functions like filetime() didn't look from outside on a file. But in my experience is this quite fast if you only load one row:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FileTimeLog:&lt;/P&gt;&lt;P&gt;First 1&lt;/P&gt;&lt;P&gt;Load *, filename() as FileName, filetime() as FileTime From xyz;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could use these FileTimeLog to identify those logs which aren't loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another possibility could be to move each log-file after reload to another folder so that you have only the newest log-files in your log-file-folder. If you can't or don't want to move the log-files you could copy them and make before the load a synchronization with robocopy in a special load-folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Aug 2014 11:31:23 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2014-08-01T11:31:23Z</dc:date>
    <item>
      <title>Loading data based on modified file time</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-data-based-on-modified-file-time/m-p/696375#M251576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've got some log files that I need to load and parse for audit purposes - that bit I can do no problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These files can grow very large and I have got many (scores) of Instances each creating their own log files. Unfortunately the log files do not cut-over after a set time but rather when they grow to a certain size - hence each file can have many days of activity or just a few hours or minutes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The logs are all called: "tm1server.log". When the log becomes a certain size it will rename to "tm1server.log.1" and start a fresh log. If there's already a log called "tm1server.log.1" that log will be renamed to "tm1server.log.2" and so on, hence the higher the number appended the older the log. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jiveImage" src="https://community.qlik.com/legacyfs/online/63558_pastedImage_1.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what I want to do is on a daily basis load any file that has been updated since the start of the previous day. Then I can parse the file to keep just yesterdays data for certain entries in the files. This results in a file that is just kb in size even though I'm potentially loading 10's of GB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because of the poor naming convention and the way the files cut-over (based on size not date) the only way I can think to limit what I load is based on &lt;SPAN style="color: #0000ff;"&gt;filetime&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;()&lt;/SPAN&gt;. I have written this script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&lt;SPAN style="color: #0000ff;"&gt;For each&lt;/SPAN&gt; Instance &lt;SPAN style="color: #0000ff;"&gt;in&lt;/SPAN&gt; 'alm-2u', 'cmac_inv-1u', 'cmac_scs-1u', 'cobam-1u', 'ddc-2u', 'ddc-3u', 'finrecharge-1u', 'gbl-1u', 'gbm_bt-1u', 'gbm-1u'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&lt;SPAN style="color: #0000ff;"&gt;For each&lt;/SPAN&gt; tm1serverlog &lt;SPAN style="color: #0000ff;"&gt;in&lt;/SPAN&gt; '\\GBW04804\UAT_Instance\$(Instance)\log\tm1server.log*'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;recent_logs:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&lt;SPAN style="color: #0000ff;"&gt;LOAD&lt;/SPAN&gt; *,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: terminal,monaco;"&gt;FROM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;$(tm1serverlog)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;(txt, utf8, no labels, delimiter is ',', msq)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&lt;SPAN style="color: #0000ff;"&gt;WHERE&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;Date&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;filetime&lt;/SPAN&gt;(), 'DD/MM/YYYY') &amp;gt;= &lt;SPAN style="color: #0000ff;"&gt;today&lt;/SPAN&gt;()-1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;next tm1serverlog&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;next Instance&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now this is a test script based on just 10 Instances and I've got scores. For just a couple of weeks data it's taking 35 minutes to reload due to the number and size of logs. Long term it's not practical to load all logs every day. Unfortunately the above script although works does not improve load times because QlikView seems to open and load the file before it evaluates the &lt;SPAN style="color: #0000ff;"&gt;filetime&lt;/SPAN&gt;() hence it loads every file instead of simply disregarding the older files before load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to totally ignore files based on when they are modified? i.e. So QlikView does not have to load the entire file before it disregards it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2014 09:18:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-data-based-on-modified-file-time/m-p/696375#M251576</guid>
      <dc:creator>shane_spencer</dc:creator>
      <dc:date>2014-08-01T09:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Loading data based on modified file time</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-data-based-on-modified-file-time/m-p/696376#M251577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You meant TM1 did a rename from all log-files each time there is a new one - possibly thousands of files every xx minutes? There are none better settings possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you are right with the assumption that qv always evaluates the complete load-statement and file-functions like filetime() didn't look from outside on a file. But in my experience is this quite fast if you only load one row:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FileTimeLog:&lt;/P&gt;&lt;P&gt;First 1&lt;/P&gt;&lt;P&gt;Load *, filename() as FileName, filetime() as FileTime From xyz;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could use these FileTimeLog to identify those logs which aren't loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another possibility could be to move each log-file after reload to another folder so that you have only the newest log-files in your log-file-folder. If you can't or don't want to move the log-files you could copy them and make before the load a synchronization with robocopy in a special load-folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2014 11:31:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-data-based-on-modified-file-time/m-p/696376#M251577</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2014-08-01T11:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Loading data based on modified file time</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-data-based-on-modified-file-time/m-p/696377#M251578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus, yes that's correct. The functionality around the TM1 logs is really poor, we've got enhancement requests with IBM but it's not likely to result in anything soon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem with using First 1 would be that I get a list of files, but in the time it takes to do that and then do a full load of that list of files is that some could have been renamed in the meantime. Ergo the "tm1server.log.1" file I'm loading could actually have been called "tm1server.log" a few minutes before and the "tm1server.log.1" I was hoping to load has been renamed to "tm1server.log.2" and is missed off my load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll consider the moving option but not sure if other constraints will prevent me from being able to do that. Thanks for your suggestions though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2014 12:14:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-data-based-on-modified-file-time/m-p/696377#M251578</guid>
      <dc:creator>shane_spencer</dc:creator>
      <dc:date>2014-08-01T12:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Loading data based on modified file time</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-data-based-on-modified-file-time/m-p/696378#M251579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried the &lt;SPAN style="color: #0000ff;"&gt;First 1&lt;/SPAN&gt; option and that does indeed run in a matter of seconds. So perhaps if I schedule the reloads for when the logs are not going to be written to I can use this option. So I've written this script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;for each Instance in DirList('\\GBW04804\UAT_Instance\*')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;for each tm1serverlog in FileList('$(Instance)\log\tm1server.log*')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;all_log_names:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;First 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;LOAD @1,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;Date(filetime(), 'DD/MM/YYYY') as ModTimeStamp,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;'$(tm1serverlog)' as logfilename&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;FROM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;$(tm1serverlog)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;(txt, utf8, no labels, delimiter is ',', msq);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;next tm1serverlog&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;next Instance&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;recent_logs_names:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;LOAD ModTimeStamp,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;logfilename&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;Resident all_log_names&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;WHERE ModTimeStamp &amp;gt;= today()-1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;drop table all_log_names;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;So I've got a field with a list of all the logs I want to reload. i.e.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jiveImage" src="https://community.qlik.com/legacyfs/online/63570_pastedImage_10.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;...but how do I use the values in that field to do a full load of those logs listed?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2014 13:19:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-data-based-on-modified-file-time/m-p/696378#M251579</guid>
      <dc:creator>shane_spencer</dc:creator>
      <dc:date>2014-08-01T13:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Re: Loading data based on modified file time</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-data-based-on-modified-file-time/m-p/696379#M251580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ignore the last post I think I've found the answer in &lt;A href="https://community.qlik.com/qlik-users/4003"&gt;Henric Cronström&lt;/A&gt; blog:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2013/09/02/loops-in-the-script" title="http://community.qlik.com/blogs/qlikviewdesignblog/2013/09/02/loops-in-the-script"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2013/09/02/loops-in-the-script&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&lt;SPAN style="color: #0000ff;"&gt;For&lt;/SPAN&gt; vFileNo = 1 &lt;SPAN style="color: #0000ff;"&gt;to NoOfRows&lt;/SPAN&gt;('recent_logs_names')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;Let&lt;/SPAN&gt; vFileName = &lt;SPAN style="color: #0000ff;"&gt;Peek&lt;/SPAN&gt;('logfilename',&lt;SPAN style="color: #ff0000;"&gt;vFileNo&lt;/SPAN&gt;-1,'recent_logs_names');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;Load&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;@1&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '$(vFileName)' &lt;SPAN style="color: #0000ff;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;logfilename&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;From&lt;/SPAN&gt; [$(vFileName)]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (txt, utf8, no labels, delimiter is ',', msq);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;Next&lt;/SPAN&gt; vFileNo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: terminal,monaco;"&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;nb I got the load time to just under 2 1/2 minutes, but that was searching ALL log files not just the sample 10.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2014 13:55:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-data-based-on-modified-file-time/m-p/696379#M251580</guid>
      <dc:creator>shane_spencer</dc:creator>
      <dc:date>2014-08-01T13:55:12Z</dc:date>
    </item>
  </channel>
</rss>

