Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load XML with nested children into a flat table


We have a MySQL table with one field containing an XML string. The structure of the XML can be seen in the attached XML file. Basically, it looks like this:






I start by loading this XML field like below:


SQL SELECT house, type, regnr, booking FROM t_stat;

Then I add the house, type and regnr to that XML. These three are our parent key for all <articles>.





&'</stat_row></stat>' as stat_concat

RESIDENT t_stat_temp

WHERE booking > '';

LET stat_concat = peek('stat_concat');

I then tried to load all these fields into one single flat table:


house&'_'&type&'_'&regnr as article_key,

type as type,

regnr as regnr,

house as house,

[articles/article/arnr] as arnr,

[articles/article/name] as name,

[articles/article/price] as price,

[articles/article/sum] as sum,

[articles/article/rtype] as rtype,

[articles/article/grp] as grp,

[articles/article/uarr] as uarr,

[articles/article/udep] as udep

INLINE '$(stat_concat)' (XmlSimple, table is [stat/stat_row], unicode);

Unfortunately this failed. Only the very first article was loaded, all the others were ignored. Eventually I want the final table to look like this:

126731_020_00052326731000523020657Article Name 122.9045.8400012648132001264899600
226731_020_00052326731000523020658Article Name 222.9045.8400012648132001264899600
3920123_020_8365392012383653020241Article Name 322.9045.8100012648132001264899600

The id should be generated automatically somehow. How can I achieve this?

Thanks for any help in advance!

Best Regards

1 Reply
Partner - Contributor III
Partner - Contributor III

Hi Kevin,

If you have an XML-File you can laod it normaly.

You can use Dateformat.

2017-09-14 17_27_36-Qlik Sense Desktop.png

This will be generated on the load-script:

FROM [lib://test/preview.xml]

(XmlSimple, table is [stat/stat_row/articles/article]);