4 Replies Latest reply: Jan 31, 2017 5:06 AM by Samuel LEFRANC RSS

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

    Samuel LEFRANC

      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