Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In QlikView load script, I want to load all pipe-delimited *.txt files from a folder into a single table and indicate their source via calculated columns as part of the load. This should look something like this:
SET FileLocation='somelocation\*-20171017-*.txt';
For each file in FileList('$(FileLocation)')
TransactionLogs:
LOAD *,
left(subfield(subfield('$(file)','\',-1),'-',1),3) as filelocationcode,
FileTime('$(file)') as Date_file autogenerate 1
FROM [$(file)] (txt, codepage is 1252, embedded labels, delimiter is '|');
Next;
I was able to the get the parsing of the filename to work separately, but can I combine this code all in one load statement?
I do want all the data concatenated into a single table.
can someone help me get the syntax right?
I got it:
logfiles: LOAD *, FileBaseName() as SourceFile, FileTime() as TransmissionDateTime, left(subfield(FileBaseName(),'-',1),3) as FileFacilityID FROM [$(FileLocation)] (txt, codepage is 1252, embedded labels, delimiter is '|');