Created
April 4, 2013 22:08
-
-
Save ralfbecher/5314826 to your computer and use it in GitHub Desktop.
Load flat file (CSV or else) with field names containing square brackets "[ ]" into QlikView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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