Skip to main content
Announcements
Meet the 2024 Qlik Luminaries and Partner Ambassadors! READ ON!
cancel
Showing results for 
Search instead for 
Did you mean: 
slefranc
Partner - Contributor II
Partner - Contributor II

How does the "LOAD from_field" work with xml format ?

Hi,

Could someone help me with the use of the "LOAD from_field" in my script ?

You will find in attachment a very simple application and its datasource : a csv file which contains 3 rows, and for each row :

- few basic data (rank, name)

- a field "data_as_csv" which could be interpreted as a csv file

- a field "data_as_xml" which contains exactly the same information, but in a xml format.

I want to create a new table based on this "data_as_xxx", which will contain 3 rows, and for each row, 3 fields T1, T2, T3, using the "LOAD from_field" instruction

I have no problem with the csv format :

datasource:

LOAD rank,

     name,

     data_as_csv,

     data_as_xml

FROM example_load_from_field.csv (txt, codepage is 1252, embedded labels, delimiter is ';', msq);

CSVResult:

LOAD @1 as T1,

     @2 as T2,

     @3 as T3

From_Field (datasource,data_as_csv) (txt, no labels, delimiter is '|');

But when I try the same with the xml format instead of the csv format (which is my goal) ...

XMLResult:

LOAD T1,

     T2,

     T3

From_Field (datasource,data_as_xml) (xmlSimple, Table is [notes]);

...I've got  a "General script error". What's wrong with my code ?

I've seen that it works when the datasource contains only one row, but I don(t understand why it could works with csv format and not xml one ?

Thanks for your help.

Sam

1 Solution

Accepted Solutions
slefranc
Partner - Contributor II
Partner - Contributor II
Author

I've just find that it was a bug from QV11 (which is the version I use on my laptop).

It's now OK with QV12 : just checked on my Qlikview server.

Problem solved, thx for your help !

Sam

View solution in original post

4 Replies
vinieme12
Champion III
Champion III

Can you post the xml you are trying to load from?

Have you tried using the data load wizard?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

Try like this

QlikView XML File

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
slefranc
Partner - Contributor II
Partner - Contributor II
Author

The fact is that I don't load one "physical" xml file : I load a datasource with several rows and fields, and one of this fields contains an xml structure (the same structure for each row of my datasource). Tell me if you can't open the csv file I attached on my first post, it will clarify all that.

However, just to answer to your question, if I make a physical xml file from one of the record of my datasource, I got something like that (see the sample.xml attachment)

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

  <T1>15</T1>

  <T2>10</T2>

  <T3>20</T3>

</notes>

And if I use the wizard to load this sample, I've got :

// Start of [sample.xml] LOAD statements

notes:

LOAD T1,

    T2,

    T3

FROM [sample.xml] (XmlSimple, Table is [notes]);

// End of [sample.xml] LOAD statements

which is exactly the code I used, except i use "From_Field" instead of "From [sample.xml]"

slefranc
Partner - Contributor II
Partner - Contributor II
Author

I've just find that it was a bug from QV11 (which is the version I use on my laptop).

It's now OK with QV12 : just checked on my Qlikview server.

Problem solved, thx for your help !

Sam