Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
stabben23
Master
Master

For loop with date in filename

Hi, I want to loop throug a folder With logfiles containing a date in filname.

I want to start Reading With the file that have start date 2017-08-21 to 2017-08-27 (end date).

The Variables contain correct date, problem is related to "for i", how should use "for i" here.

Filename is ex Brd_2017-08-21.txt

This is what I have done without success.

Let vThisWeekStart = date(WeekStart(today(1)));
Let vThisWeekEnd = date(WeekEnd(today(1)));

for i = '$(vThisWeekStart)'to '$(vThisWeekEnd)';

For each vFileName in Filelist ('\\1.1.1.1\folder\Brd_'& $(i) &'.txt')

  Table:
LOAD
*
From $(vFileName)
(
txt, codepage is 1252, no labels, delimiter is '\t', msq)
Next vFileName
Next i

1 Solution

Accepted Solutions
marcus_malinow
Specialist III
Specialist III

How about this:

Let vThisWeekStart = date(WeekStart(today(1)));

Let vThisWeekEnd = date(WeekEnd(today(1)));

for i = '$(vThisWeekStart)'to '$(vThisWeekEnd)';

LET vFileName = '\\1.1.1.1\folder\Brd_'& Date($(i), 'YYYY-MM-DD') &'.txt';

TRACE $(vFileName);

  Table:

LOAD

*

From $(vFileName)

(txt, codepage is 1252, no labels, delimiter is '\t', msq);

Next i

View solution in original post

2 Replies
marcus_malinow
Specialist III
Specialist III

How about this:

Let vThisWeekStart = date(WeekStart(today(1)));

Let vThisWeekEnd = date(WeekEnd(today(1)));

for i = '$(vThisWeekStart)'to '$(vThisWeekEnd)';

LET vFileName = '\\1.1.1.1\folder\Brd_'& Date($(i), 'YYYY-MM-DD') &'.txt';

TRACE $(vFileName);

  Table:

LOAD

*

From $(vFileName)

(txt, codepage is 1252, no labels, delimiter is '\t', msq);

Next i

View solution in original post

stabben23
Master
Master
Author

Thanks Marcus,

Date($(i), 'YYYY-MM-DD') did the trick.