Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All, I'm loading data from ~100 xml files which have the same field definitions except for the key. The key is suffixed with random numbers e.g. key12345.
Based on the manual I cannot use wildcards in fields names so I cannot say
Load
date,
name,
key* as key
from mydir\*.xml.
I thought about Load * and then using FieldName() function to retrieve the field name, but load * doesn't work with xml files.
What can I do?
I do not want to create 100 load statements.
Thanks,
Gene
Try Below Solution. Hope this helps
LOAD
SubField(@2, '=',2) AS Date,
SubField(@3, '=',2) AS Name,
Replace(SubField(@4, '=',2), '/>',' ') AS Key
FROM
[*.xml]
(txt, codepage is 1252, explicit labels, delimiter is spaces, msq);
Maybe as a workaround: load all files (quick&dirty) and by copying / extracting the key-fields (from script or $fields) to excel and using the filter function you get a complete list of all keys. Use the list in a mapping table or with the rename fct (rename function could also be prepared in excel and copy the function-list in the qv script).