Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
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?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
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);

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
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.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
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?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
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 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful