Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
scjoel02
Partner - Contributor
Partner - Contributor

Load Field Name As Value

Greetings Qlik Community!

I have a series of .xml files that store the actual key value as the field name.

I need to load all files, assigning the FieldName as the value stored inside a new field.

It's my understanding that you can't use the FieldName function on a data ingestion. It has to be already preloaded into memory, in order to specify the table name.

Using CrossTable requires inserting the field name to assign as the new field, and that field name is different in every xml file.

The files are structured like the following:

File1:

Field 1,               Field 2,          Key_ABC123

Red,                    Apple,               0

File2;

Field 1,               Field 2,          Key_DEF456

Yellow,               Banana,              0

I need to combine these files (with a Load *, because there are way too many to load and concatenate them manually), and assign the Key Field Name as the actual value stored inside of a new key field.

Like this:

Field 1,          Field 2,               Key

Red,              Apple,               ABC123

Yellow,          Banana,             DEF456

Perhaps with a loop?

Any suggestions greatly appreciated.

Thanks!

3 Replies
sunny_talwar

You can always use LOAD * to avoid entering different field names.

CrossTable(....)

LOAD *

FROM Source.....

scjoel02
Partner - Contributor
Partner - Contributor
Author

Hi Sunny.

You can't Load * from an XML. I could potentially store everything into a QVD, or resident load and then crosstable, but how could I Crosstable multiple field names into one?

Thanks.

sunny_talwar

Oh really, XML don't allow for *? I have never loaded from one, so I didn't know that.