Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I'm reading a table from SQL database
the table has a column of type xml
how can I parse this column in script? or is there another approach?
kindly advise
Here's the general idea:
Rawdata:
LOAD *
;
SELECT Id, Name, Whatever, myxml from MyTable;
xmldata:
LOAD
blah
FROM FIELD (Rawdata, myxml) (XmlSimple, Table is [foo]);
The easiest way to generate the "blah" and "foo" bits is to save one of the "myxml" rows in an xml file and use the table files wizard to generate the xml load statement.
If the values in your xml column don't have an enclosing element, then you may need to fake one in as shown in this thread.
Need assistance for importing data with XML
-Rob
Rob,
I am able to get all of this to work. Now that the FROM_FIELD load is parsing the XML I can not figure out how to join it back to the original data set. It seems that the FROM_FIELD script only has access to what is in the XML file (there is no key) there. This XML is a column from a row in a larger data set and I need to be able to join it back to the original data set to reconnect it with the rest of the data from that particular row.
For what its worth, the original dataset is being pulled from a SQL db. My hope is to do the XML parsing on the Qlik side as to save the DB from the pressure of the XQuery.