Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Dywalker
Contributor
Contributor

Loop start with "Sql Select" and end with "Field Found"

Hello Everybody,

I need to go trough log files and calculate the time a query takes to finish.

I have three columns

Date , Hour, Query

2020.04.02 / 07:00:00 / BLABLA

2020.04.02 / 07:01:00 / SQL Select

2020.04.02 / 07:01:02 / BLABLA

2020.04.02 / 07:01:03 / BLABLA

2020.04.02 / 07:01:04 / 30 Fields Found

In the column Query i have the data. 

I need to loop trough every row with a condition.

The condition is : Start loop when you find "Sql Select" and finish loop when you find "Fields Found" then go to the next "Sql Select"

After i need to calculate the time of execution so ( HOUR of Field Found - HOUR of Sql select)

Can you help me ? Thank you.

 

Labels (1)
1 Reply
Dywalker
Contributor
Contributor
Author

Hello , there is the beggining of my code.
I know is not great but I don't know the Qlick functions well.
 
Source:
LOAD
    "@1:11" as Date,
    "@12:20" as Heure,
    "@25:53" as SqlFound
FROM [lib://AttachedFiles/OpusQlik_interne.qvw.log]
(fix, utf8, no labels);
LET rowText = NoOfRows('Source'); // get the total number of rows in Timeline table
 
//   let SqlSelect = FieldValue('SQL SELECT',$(i)); //g
//   let Found = FieldValue('FIELDS FOUND',$(i));
if peek('SQL SELECT', i, SqlFound)  then
for i=1 to $(rowText) // loop through every row

Table1:
load
$(i) as no,
Date,
Heure,
SqlFound
 Resident Source
where RecNo()=$(i);
next;
drop Table Source;