Skip to main content Skip to footer

Use an XML Data Source with C1FlexReport

Background:

This article discusses how to bind a C1FlexReport with an XML Data Source.

Steps to Complete:

To bind a report to data stored in an external XML file, using C1FlexReportDesigner App, follow the below-mentioned steps:

1. Open the C1FlexReportDesigner App.

2. Create a new report or open an existing report in the designer.

3. Click the Data tab.

4. Expand the Data Sources node.

5. Right-click the data source you want to edit and select Edit.

a. The Data Sources dialog box opens. Select "Connection to XML database" option and provide the Connection string for XML file.

XML Data Source Selection

6. Select Table from Data source.

Now, the report is bound to an XML file. The required fields can be selected to be displayed on the report.

Further, XML data source for a report can be set at runtime as well. For this, you can make use of DataSet instance, which is loaded with the XML data. This instance is then used to set Recordset for the report.

For example:

C#

//DataSet to get XML data
DataSet dset = new DataSet();
dset.ReadXml("schema.xsd");
// Set the DataSource
C1FlexReport1.DataSource.Recordset = dset.Tables["shipto"];

VB

'DataSet to get XML data
Dim dset As New DataSet()
dset.ReadXml(“schema.xsd")
'Set the DataSource
C1FlexReport1.DataSource.Recordset = dset.Tables("shipto")

Esha Dhir