Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
slefranc
Partner - Contributor II
Partner - Contributor II

Load xml nodes as a unique field

Hi,

Is there a way, when your script have to load an xml file, to create a field whose contents is a full node of the original xml file ?

Let's take a very simple example. Here is the xml source file body (find the file in attachement)

<?xml version="1.0" encoding="UTF-8"?>

<student>

  <firstname>John</firstname>

  <lastname>DOE</lastname>

  <items>

    <item>

      <code>A</code>

      <value>10</value>

    </item>

    <item>

      <code>B</code>

      <value>20</value>

    </item>

  </items>

</student>

If i use the wizard to load this file, Qlikview will generate 2 tables

item:

LOAD code,

    value,

    %Key_student_C932B46F5721DF6D    // Key to parent table: student

FROM (XmlSimple, Table is [student/items/item]);

student:

LOAD firstname,

    lastname,

    %Key_student_C932B46F5721DF6D    // Key for this table: student

FROM (XmlSimple, Table is [student]);

My Goal is to have only3 fields, one of them containing the all node "items". Something like that :

firstname

lastname items
JohnDOE<item><code>A</code><value>10</value></item><item><code>B</code><value>20</value></item>

Why that ? Because for the moment, I don't need any information about "items", but I want to collect this information and store it in my QVD, so that I will be able to parse it later if needed.

Have in mind that the node I want to store as it is is more complicated as in this example. It could contain other nodes which could contain other nodes... which would give me many tables linked each one to others, when I just need a way to store the information for later use.

Is there a way, or a trick, to get to that ?

Thanks for your help.

Sam

2 Replies
Gysbert_Wassenaar

The easy way out is to simply store the item table to a qvd and drop it. When you need the data you can simply load the data from the qvd. It will be linked automatically using the Key_student_C932B46F5721DF6D field.


talk is cheap, supply exceeds demand
slefranc
Partner - Contributor II
Partner - Contributor II
Author

Thx, I agree, in my example, this could be the easiest way.

In my real case, it would not be one extra table to store as QVD, but many more, because of the structure of my xml node (tables in tables...), and as many QVD files to maintain on every update made by my collector...