<?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: Loop through log files in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419189#M428385</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Andrew, it did not quite work the way I wanted, but it did give me some ideas, so thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Sep 2017 10:11:09 GMT</pubDate>
    <dc:creator>rustyfishbones</dc:creator>
    <dc:date>2017-09-27T10:11:09Z</dc:date>
    <item>
      <title>Loop through log files</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419186#M428382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a hundreds of log files and I want to loop through them and calculate the duration between the start of a transaction and the end&lt;/P&gt;&lt;P&gt;below is an excerpt from the file, 4 lines, the first line is the start and the last line is the end, my files contain thousands of these&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;"02/06/2017" "08:38:35.008" "RECV" "prTaskLUTPicked('06-02-17 08:38:32.000','6315320077','Alan','Group ID','GC.D.7','D4D10','2','1','1','1','','','')&amp;lt;CR&amp;gt;&amp;lt;LF&amp;lt;LF&amp;gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;"02/06/2017" "08:38:36.781" "SEND" "0,&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;"02/06/2017" "08:38:36.808" "RECV" "prTaskLUTGetPicks('06-02-17 08:38:34.000','6315320077','Alan','Group ID','0','0','0')&amp;lt;CR&amp;gt;&amp;lt;LF&amp;lt;LF&amp;gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;"02/06/2017" "08:38:37.293" "SEND" "N,0,1,D4D10,0,,D 1,,0 1 0 2 D,7,Singles,0029203,0,0,0,0,033,,,description,,,GC.D.7,013,,0,,,,0,,,0,0,0,0,0,&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;I would like to create a table that contains data from the first line and the last line, the first line will always contain &lt;SPAN style="font-size: 10.6667px;"&gt;prTaskLUTPicked and the last line will always start with "N,0,1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.6667px;"&gt;"02/06/2017" "08:38:35.008" "RECV" &lt;SPAN style="font-size: 10.6667px;"&gt;"02/06/2017" "08:38:37.293" "SEND" "N,0,1,D4D10,0,,D 1,,0 1 0 2 D,7,Singles,0029203,0,0,0,0,033,,,description,,,GC.D.7,013&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.6667px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.6667px;"&gt;What is the best way to create this, Use Previous function, or create a temp table&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2017 15:30:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419186#M428382</guid>
      <dc:creator>rustyfishbones</dc:creator>
      <dc:date>2017-09-26T15:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through log files</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419187#M428383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alan,&lt;/P&gt;&lt;P&gt;I copied your data into a txt file (log.txt) and ran this script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Log:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;if(Status='Start', AutoNumber(@2),Peek(TransactionID)) as TransactionID,&lt;/P&gt;&lt;P&gt;*;&lt;/P&gt;&lt;P&gt;LOAD @1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @2,&lt;/P&gt;&lt;P&gt;if(Wildmatch(@4,'prTaskLUTPicked*'),'Start','End') as Status&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;log.txt&lt;/P&gt;&lt;P&gt;(txt, codepage is 1252, no labels, delimiter is ' ', msq)&lt;/P&gt;&lt;P&gt;Where Wildmatch(@4,'prTaskLUTPicked*','N,0,1*');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Durations:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;TransactionID,&lt;/P&gt;&lt;P&gt;Time(Min(@2)) as Start,&lt;/P&gt;&lt;P&gt;Time(Max(@2)) as End,&lt;/P&gt;&lt;P&gt;Interval(Max(@2)-Min(@2)) as Duration&lt;/P&gt;&lt;P&gt;Resident Log&lt;/P&gt;&lt;P&gt;Group by TransactionID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Giving:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE bgcolor="#ffffff" border="1" cellpadding="2" cellspacing="0" style="font-size: 9pt;"&gt;&lt;TBODY&gt;&lt;TR bgcolor="#f5f5f5"&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;TransactionID&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;Start&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;End&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;Duration&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR bgcolor="#ffffff"&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;08:38:35.008&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;08:38:37.293&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;00:00:02.285&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you can load all your logfiles using a * wildcard, then if appropriate sort all the lines by the first time field then run something like the above script which takes out every line that is not a Start or End Time. Then it labels the rows with an autonumber to identify transactions then the Durations table is grouped on the TransactionID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2017 16:11:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419187#M428383</guid>
      <dc:creator>effinty2112</dc:creator>
      <dc:date>2017-09-26T16:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through log files</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419188#M428384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for that, I am using a for each loop, to loop through all log files in the directory and sub directories.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got what I need working using previous, but it's not very efficient, I will try your suggestion and get back to you tomorrow &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sent from my iPhone&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2017 19:26:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419188#M428384</guid>
      <dc:creator>rustyfishbones</dc:creator>
      <dc:date>2017-09-26T19:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through log files</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419189#M428385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Andrew, it did not quite work the way I wanted, but it did give me some ideas, so thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2017 10:11:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419189#M428385</guid>
      <dc:creator>rustyfishbones</dc:creator>
      <dc:date>2017-09-27T10:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through log files</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419190#M428386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another approach could be to load at first the log-file completely and using then an outside peek() within a following load to access the first and the last record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could imagine that it might be slightly faster than the solution from Andrew because no where-clause is applied and no if-loop is needed to determine the first/last record. But I'm not sure that it - by hundreds of (assumingly rather small) files - made it bigger difference because the overhead for looping and accessing all the files is rather big compared to the amount of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2017 11:15:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419190#M428386</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2017-09-27T11:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through log files</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419191#M428387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus/Andrew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As part of my project I need to show the log file within the Application, so I have concatenated each row from the file into a single string called logfile and it looks like the below image&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2017-09-27_1836.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/177912_2017-09-27_1836.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to do next is to color the lines if the start time "07:52:47.050" minus the End Time is greater than 1 second and if it is, color all the lines between red, otherwise leave them green&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The file contains hundreds of records and I am currently displaying them in a Pivot Table and trying to color the text based on the times, can it be done, I want to do this as a color expression.&lt;/P&gt;&lt;P&gt;The Pivot Table contains 1 Dimension called LogFile and 1 expression but it's blank, I am hoping it could be done from the color expression. Is it possible&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2017-09-27_1845.png" class="jive-image image-2" height="149" src="https://community.qlik.com/legacyfs/online/177920_2017-09-27_1845.png" style="height: 148.449px; width: 221px;" width="221" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you can help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2017 17:47:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419191#M428387</guid>
      <dc:creator>rustyfishbones</dc:creator>
      <dc:date>2017-09-27T17:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through log files</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419192#M428388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I would tend to create this information with a flag-field within the script - just 0 and 1 on the record-level and using this to color the rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2017 19:11:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419192#M428388</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2017-09-27T19:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through log files</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419193#M428389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming you have Startdate and Enddate as separate field along with your data field&amp;nbsp; you can put the&amp;nbsp; condition like&amp;nbsp; below in the background Color&amp;nbsp; of the expression tab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if( timestamp(enddate-Startdate) &amp;gt;1 and ( wildmatch(Data,'*taslklupicked*' ,'*n,0,1*' )=0 , red(),green())&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Sep 2017 09:50:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-log-files/m-p/1419193#M428389</guid>
      <dc:creator>qliksus</dc:creator>
      <dc:date>2017-09-29T09:50:52Z</dc:date>
    </item>
  </channel>
</rss>

