Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Every hour i am receiving one new file .I need to pick the latest file for loading .
I am thinking two ways to do
1.Moving the file to Archive folder once it is loaded
2.Picking the latest file based on system date .
Please suggest me which way is better ans how to do in Qlikview .
Thanks,
Rahul
alltxtfiles:
load distinct
FileName() as fn,
FileTime() as ft
FROM *.csv;
lasttxtfile:
First 1
load fn as lastfn, ft as lastft
Resident alltxtfiles
order by ft desc; // desc for last, asc for sirst
You can use both, to look at the filestamp protects you if youre script runs on a problem for a houre or youre qv-service is down and on the next run there are two files.
CSV-Files use lot of space, if you dont use it any more you can at it to a compressed filecontainer. With execute you can use some applications like seven zip.
You find some code in the help of "for each ... next" , "filetime" and "execute"
alltxtfiles:
load distinct
FileName() as fn,
FileTime() as ft
FROM *.csv;
lasttxtfile:
First 1
load fn as lastfn, ft as lastft
Resident alltxtfiles
order by ft desc; // desc for last, asc for sirst
you can read files from the directory and check the latest date/time with the function - filetime( 'file' )