Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
deepakqlikview_123
Specialist
Specialist

For loop not working

Hi All,

I am fetching publisher log information from the server. However, the for loop is not working.

only whatever mentioned in the variable, can fetch the respective logs.

Actually, need to fetch the Tasklog information for the last 7 days but only 1-day of information is visible.

Attached is the file for the same.

Need some advice on this.

Thanks in advance.

QlikView Qlik Sense 

 

12 Replies
Anil_Babu_Samineni

You have given half question, We don't know what to checka and which is not working. Would you like to rephrase your question?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
deepakqlikview_123
Specialist
Specialist
Author

updated the comment,

Anil_Babu_Samineni

You are using only one date in the variable? 

Let yesterdate = Date(Today()-1, 'YYYYMMDD');

But also, I can see that you are doing too much for that, I would rather use simply like this

Let yesterdate = Date(Today()-1, 'YYYYMMDD');

Let weekbackyesterdate = Date(Today()-8, 'YYYYMMDD');

for each Tasklog in FileList('D:\Publisher Logs\1\Log\TaskLog.txt')

RLdata:
LOAD '$(Tasklog)' as FileName,
@1,
@2,
@3

FROM $(Tasklog)
(txt, utf8, no labels, delimiter is '\t', msq) Where Field>=$(weekbackyesterdate) and Field<=$(yesterdate);

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
deepakqlikview_123
Specialist
Specialist
Author

May I know the Field in the above logic? and the field column is not there in the original table.

Anil_Babu_Samineni

Field is something about you want to compare with date field.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
deepakqlikview_123
Specialist
Specialist
Author

But where to fetch the field. that is not available in the table.

Anil_Babu_Samineni

Can you share the file name as an example so that i can give complete script?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
deepakqlikview_123
Specialist
Specialist
Author

PFA.

The file is in different folders and the nested for loop is required to fetch data from them.

Anil_Babu_Samineni

Check all these If something can be achieved via Sub routine? Here 

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)