Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Can't use Wildcards on field names, what can I do?

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

11 Replies
Not applicable
Author

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);

danieloberbilli
Specialist II
Specialist II

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