Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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
MVP
MVP

Re: Load table with only headers as meta data for table

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

Not applicable

Re: Load table with only headers as meta data for table

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

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

Thanks,

Boris

MVP
MVP

Re: Load table with only headers as meta data for table

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.

Not applicable

Re: Load table with only headers as meta data for table

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

MVP
MVP

Re: Load table with only headers as meta data for table

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..

Community Browser