Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
daveatkins
Partner - Creator III
Partner - Creator III

load a filelist with filename, attributes as columns

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?

1 Reply
daveatkins
Partner - Creator III
Partner - Creator III
Author

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 '|');