Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Onur Civelek, I´ve done
1) Create a folder into my machine D:\Qlikview11\DistributionService\1\Log
2) Copied the files to this folder
3) Adjusted the script to this folder
runs smoothly
PFA the app with the data
I´ve noticed you´re using an IR version. Would you mind to upgrade it do SR3?
Regards
Please don't cross post: http://community.qlik.com/thread/97549
SET PATH='yourpathgoeshere';
LET TwoDays=date(today()-2,'YYYYMMDD');
for each file in FileList('$(PATH)\Root*.txt')
if '$(file)' follows 'Root_$(TwoDays).txt'
// do something
end if
next
Hi Clever,
thank you. But how can i implement the LOAD Statement in this adviced scriptcode.
I tried this and get an error. I attached my qvw. Please can you check this
SET PATH='D:\Qlikview11\DistributionService\1\Log';
LET TwoDays=date(today()-2,'YYYYMMDD');
for each file in FileList('$(PATH)\Root_*.txt')
if '$(file)' follows 'Root_$(TwoDays).txt'
//do something start
QMCLogfile:
LOAD @1,
@2,
@3,
@4
FROM '$(file)' (txt, utf8, no labels, delimiter is ',', msq);
//do something end
end if
next
Can you give me an example ?
Sorry, I have fixed it
Copy and paste to your app
SET PATH='C:\ProgramData\QlikTech\DistributionService\1\Log';
LET TwoDays=date(today()-2,'YYYYMMDD');
for each file in FileList('$(PATH)\Root_*.txt')
let filebasename =subfield('$(file)','\',-1);
if '$(filebasename)' follows 'Root_$(TwoDays).txt' then
QMCLogfile:
LOAD
@1,
@2,
@3
FROM [$(file)](txt, utf8, no labels, delimiter is '\t', msq);
end if
next
Hi Clever,
first of all thank you for your help. For this, I am really very grateful. But if i execute your modified script, then i get no loaded objects/objektdiagram in my diagram. The app are empty.
The variable filebasename stored the value "Root_20111222.txt" Should this be so or it is a bug ?
Because I do not care for this old file? In named path the number of historical files.
But interesting to me are just the two latest files.
Maybe I have not expressed myself correctly, sorry for that. My goal is to load only the (marked) last 2 actual files. if today is the 31.10.2013, then i want to establish only the files:
D:\Qlikview11\DistributionService\1\Log\Root_20131030.txt,
D:\Qlikview11\DistributionService\1\Log\Root_20131031.txt,
Can you please look again?
Best Regards,
This variable is set inside the for loop, you don´t have to care about it
Have you changed the variable PATH to your log directory D:\Qlikview11\DistributionService\1\Log\? I don´t thing so...
The Path are defined as D:\ProgramData\QlikTech\DistributionService\1\Log
i make a video for demonstration.
Thank you again.
Best Regards,
I couldn´t open your video, maybe corrupted
Weird, because I can see the PATH into your variables set to C:\ProgramData\QlikTech\DistributionService\1\Log
Double check please
the screenshot above are previously been changed, sorry.
But you are right. i dont understand that. Maybe a bug ! look at this:
Although the script is the correct path, but the directory path is stored wrong
How can that be. This is a mystery to me.