Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi togehter,
i want to load the latest csv file in my script and dont know how i realize it. How can i pick up the latest file from this Folder ?
In this case it would be the file "28779_2010-12-27.csv"
28779_2010-12-24.csv
28779_2010-12-25.csv
28779_2010-12-26.csv
28779_2010-12-27.csv
Thank you very much !
First i would create a table with all files sorted byt their date:
first(1)
LOAD
ffilepath() as FileName,
filetime() as [Date File]
from
xxx\*.csv
order by filetime() DESC;
Then you take the name of the file
LET FileName = peek( 'FileName',0);
xxxx:
LOAD * FROM '$(FileName)';
Rgds,
Sébastien
Hi Sebastien,
thank you but the editor does not accept this part ... ORDER BY FileTime() DESC;
FileTime() is red marked ! Did something missed ?
Thank you !
here the code
FILESELEKTOR:
LOAD
FilePath() AS FileName,
FileName() AS DateFile
FROM H:\Qlikview Workspace\APILoader\reports\28779*.csv (utf8, txt, delimiter is ';', no labels, msq, header is 1 lines ) ORDER BY FileTime([FileName]) DESC;
LET FileName = peek('FileName',0);
Is that korrekt ? Thank you very much !
nobody an idea ?
Directory;
TEMP:
LOAD *,
filetime() as file_time,
filepath() as file_path,
filebasename() as z_file,
timestamp(filetime()) as time_stamp
FROM [Data\*.xls] (biff, embedded labels, table is Sheet1$);
left join (TEMP)
load
max(timestamp(file_time)) as max_time
resident TEMP;
FINAL:
LOAD *, 1 as flag
resident TEMP where time_stamp=max_time;
drop table TEMP;