By Keith Chisarik - 6/7/2010
Any examples or documentation of accessing the XML data in an XML column via BO field property?
|
By Ivan George Borges - 6/8/2010
Hi Keith. Sorry if I this is not what you are looking for, but here are some explanation and code sample on how to read XML file into a BO:http://forum.strataframe.net/FindPost681.aspx Cheers.
|
By Keith Chisarik - 6/8/2010
Thanks but that is not what I am looking for. I am looking for sample code or documentation on the SF support for XML type fields. XML fields are typed as XmlReader on the business object and I am having a hard time accessing the data in them where I have no trouble using vanilla ADO.
|
By Keith Chisarik - 6/8/2010
Lots of issues with this mainly due to not finding much in the way of documentation for this column type (if it exists I cant find it). There are no XML fields in Strataflix sample.I am able to add and save a row in a BO that contains an XML column, but I cannot access it (string conversion error) without going down to the underlying datatable, I also cannot save an update to the field as I get "The XML data type cannot be compared or sorted, except when using the IS NULL operator." Anyone have an experience using XML columns with SF that cant point me in the right direction or provide some support on this would be appreciated.
|
By Greg McGuffey - 6/8/2010
Keith, is this on SQL Server 2005?
|
By Keith Chisarik - 6/8/2010
SQL 2008 - I just hit the same exact issue with the same field as a SQL_VARIANT, Strataframe types the field as XmlReader and I dont know how to interact with it (and cant find much in the way of documentation).I went the variant route because of the issue I had with the XML field type I am doing this because I need to store user defined data.
|
By Greg McGuffey - 6/8/2010
Keith, I'll check on this with Trent and the development team regarding this and also regarding support for the other new data types (date, time, hierarchal ID, etc).
|
By Peter Jones - 6/8/2010
Hi Keith,
This may help.
We have a semi generic method of creating interfaces into ERP systems and gather the data into XML format and store that data in a SQL table. The table we use has column called ERXIFData and its data type is XML.
When we want to show contents of the ERXIFData we use a DevExpress grid and pass to it a dataset that has been generated from the XML data. One instance of ERXIFData could contain contain several 100 rows of data.
The code we use is:
Case clsENU.ERPIFType.ERPBoughtIn
ShowAnInterface(Me.luERX.Properties.GetDataSourceValue("ERXIFData", Me.luERX.ItemIndex).ToString, Me.GridControl9, Me.GridView9, Me.XMLDataSetBoughtIn)
Private Sub ShowAnInterface(ByVal ERXIFData As String, _
ByRef Grid As DevExpress.XtraGrid.GridControl, _
ByRef GridView As DevExpress.XtraGrid.Views.Grid.GridView, _
ByRef ds As System.Data.DataSet)
Dim objXmlNamespaceManager As New System.Xml.XmlNamespaceManager(New System.Xml.NameTable)
Dim reader As New System.Xml.XmlTextReader(ERXIFData, _
System.Xml.XmlNodeType.Document, _
New System.Xml.XmlParserContext(Nothing, _
objXmlNamespaceManager, _
"", _
System.Xml.XmlSpace.None))
ds.ReadXml(reader)
Grid.DataSource = ds.Tables(0)
Grid.ForceInitialize()
GridView.UpdateSummary()
clsFU.LocaliseAllControls(Grid)
reader.Close()
End Sub
And that's it.
The DevExpress Grid renders the columns in the dataset automatically (refer Grid.DataSource = ds.Tables(0)), i.e. we can pass any pieces of XML to the grid (including hierarchical) and it renders correctly.
To pass in the ERXIFData column we first convert it to String.
Cheers, Peter
|
By Keith Chisarik - 6/9/2010
Thanks for the post. So you bypass the use of a SF business object when it comes to using the XML column and just use straight ADO/.NET databinding?
|
By Keith Chisarik - 6/9/2010
Greg, thank you very much. I have an immediate need for this, will be anxiously awaiting an answer on the support for these field types within SF.
|
By Peter Jones - 6/9/2010
Hi Keith,
Kind of although the XML column is in table which is accessed via a BO. The XML data is mapped in the BO Mapper as System.String.
The data is converted into a ADO DataSet because the DevExpress grid understands what that is can parse and render it automatically.
Cheers, Peter
|
By Keith Chisarik - 6/10/2010
I see. My BO mapper see both XML and variant tpye fields as type XMLReader and I am not sure what to do with that.Greg, have you had a chance to run this by SF?
|