Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
1) The HeaderMap, what is the source? how doesr it look?
2) Rename field using - where to I indicate the target table?
Thanks,
Boris
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.
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
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..