Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
Thanks Marcus,
Date($(i), 'YYYY-MM-DD') did the trick.