Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Load flat file (CSV or else) with field names containing square brackets "[ ]" into QlikView
// load header row
Header:
FIRST 1 LOAD @1:n as First_Line
FROM flatfile.csv
(fix, codepage is 1252);
// load list of fields from source for renaming, replace square brackets with paranthesis (or something else),
// delimiter is '|'
Map_Fields:
MAPPING LOAD '@' & RowNo() as Field1, Replace(Replace(SubField(First_Line, '|'), '[', '('), ']', ')') as Field2;
Resident Header;
Drop Table Header;
// load data from source without field names (save scripting work with aliases or field qoutings)
data:
LOAD @1,
@2,
@3,
@4,
@5,
@6,
@7
FROM flatfile.csv
(txt, codepage is 1252, no labels, delimiter is '|', msq, header is 1 lines);
// Apply fixed field names to QlikView fields:
RENAME Fields using Map_Fields;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.