Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem when loading multiple XML files

Suppose I have the following xml file:

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

<person>

  <name>Nils Nilsson</name>

  <phones>

    <phone>1234567890</phone>

    <phone>0987654321</phone>

    <phone>5555555555</phone>

  </phones>

</person>

When I import this file in QV, the script would look like that:

phone:

LOAD phone%Table,

    %Key_person_F3B1C1055347A9AD    // Key to parent table: person

FROM nils.xml (XmlSimple, Table is [person/phones/phone]);

person:

LOAD name,

    %Key_person_F3B1C1055347A9AD    // Key for this table: person

FROM nils.xml (XmlSimple, Table is [person]);

The load script is split into two sections, since there are multiple phone tags. The key used between the tables is implemented using the %Key_person_F3B1C1055347A9AD field which is generated automatically.

The problem is that I have more xml files than nils.xml, and I would like to replace the specific nils.xml file name with *.xml to import them all. The thing is that the unique key between the tables will then no longer be unique and I will be unable to determine which phone numbers belong to which persons. How can I maintain a key between the tables then?

Any suggestions would be highly appreciated.

Thanks,

Uzi

Labels (1)
0 Replies