Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load table with only headers as meta data for table

Hi all,

I'm loading sets of files, creating several QVDs.

my problem is that currently this files are without headers and I need to manually add the field names.

is there a way to save a meta table with the headers and then while loading the files to set the field names automatically?

note that currently the load method is a generic subroutine and each file/table has different structure.

regards,

Boris

5 Replies
rbecher
MVP
MVP

Hi Boris,

you can load the data files w/o fieldnames (@1, @2, etc.) and the header names into a mapping table (maybe from another file) like this:

HeaderMap:

MAPPING LOAD '@' & RecNo(), <FieldName> FROM ...;

And then use

RENAME FIELD USING HeaderMap;

after the data are loaded.

- Ralf

Astrato.io Head of R&D
Not applicable
Author

1) The HeaderMap, what is the source? how doesr it look?

2) Rename field using - where to I indicate the target table?

Thanks,

Boris

rbecher
MVP
MVP

1) You could have the field names for HeaderMap in a separate file.

2) The renaming is global. But you could do this for the fields @1, @2, etc. only, after each loaded table. So, no other table will be effected.

Astrato.io Head of R&D
Not applicable
Author

So the right structure of the script is:

load meta table X with header names

load actual files and create table X' (headers still @1,@2 ...)

rename field X

load meta table Y with header names

load actual files and create table Y' (headers still @1,@2 ...)

rename field Y

etc.?

each rename will surely effect only the latest load?

And also, in matters of performance, is this procedure consuming? (I'm asking because there is a possibility

to alter the files creation and give headers - more development on the system side- and not use this meta data tables)

regards,

Boris

rbecher
MVP
MVP

To have the field names in the file header would be best case. But loading meta data and renaming shouldn't consume much time. However, each mapping table (HeaderMap) should have it's own name..

Astrato.io Head of R&D