This is a migrated thread and some comments may be shown as answers.

How to create report using XML

7 Answers 337 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
jerry
Top achievements
Rank 1
jerry asked on 07 Apr 2009, 06:28 PM

I'm using Telerik Report Q1 2009 and would like to know the best way to populate this report with xml data?
I'm using VS2008, C# and Oracle as my back end.
Within the report I'm not sure also how to reference it once the xml is passed in?

I tried the following

ReportXML rXML = new ReportXML();  
rXML.DataSource = "<XmlDS><table1><col1>Value1</col1></table1><table1><col1>Value2</col1></table1></XmlDS>";         
rvFreqReport.Report = rXML;  
rvFreqReport.RefreshReport(); 
Within my report I added a textbox and set it's value equal to =xmlds\table1\col1 to get the value for column 1.  It doesn't work correctly.  Should just see
Value1
Value2
within my report.

Thank You

7 Answers, 1 is accepted

Sort by
0
jerry
Top achievements
Rank 1
answered on 08 Apr 2009, 01:47 PM
Anyone have any ideas how I can do this?
0
Steve
Telerik team
answered on 08 Apr 2009, 03:49 PM
Hello Jerry,

In order to use XML as a report datasource, you would need to load the XML into a DataTable and assign the DataTable to the report's DataSource property.

Regards,
Steve
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
jerry
Top achievements
Rank 1
answered on 08 Apr 2009, 04:35 PM
Once I put it into a datatable who can I access it within the report?
Using the following XML how can I get to the actual name "Title"?

XML
<column> 
   <name>Title</name> 
</column> 

Does the report control handel the xml?

Do you have a link to any documentation on how to do this?

Thanks Steve

Jerry
0
Steve
Telerik team
answered on 08 Apr 2009, 04:54 PM
Hi Jerry,

You have a couple of options:
  1. (recommended) Create a typed DataSet from your XML. For more information on the typed DataSets please see here. Once you have the DataSet ready, run the Report Wizard and it will appear in the list of the available data sources; select it and follow the instructions of the wizard.
  2. Load the XML into a DataSet programatically. Use the DataSet.ReadXml method to load the XML data into a DataSet and then pass it to the Report.DataSource property. The disadvantage of this approach is that the schema of the report's data source won't be available at the design time. This means that the Report Wizard won't be of any help. Anyway you still can create a report without it. You can use the Visual Studio Toolbox to select from the available items. For more information please see Designing Reports.

Kind regards,
Steve
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
jerry
Top achievements
Rank 1
answered on 08 Apr 2009, 07:07 PM
Steve,
Thank you for your help.  I actually figured it out using an Oracle query.  But I have a problem with the report.
When I use =Name in my group header (PersonId) It should show me the persons name then info for that person in the group detail then show me the next person and so on.  But when the personId is null it returns back the name of the previous person.  How can I get around that?  Even though the PersonId isn't there I have a specific name to display but it shows the previous one even though my data comes back with the correct name for that person.


Thank You
Jerry
0
Adam
Top achievements
Rank 1
answered on 08 Apr 2009, 08:59 PM
Jerry,

A few things to try. 

1.You could do select nvl(PersonId, -1) to force oracle to give a bogus id instead of null.
2. Group on both values (personId and name) should fix it as well.  This adds a bit of extra overhead, but not that much since there shouldn't be more than one name per Id.
3.If you order by PersonId in your query, you could put all the null values first so there is no previous name to copy.  Not sure if this would work or not.
0
Francis Frank
Top achievements
Rank 1
answered on 22 Nov 2010, 11:04 AM
Please can I get a help on how to create XML from an existing Datasouce?
For instance, I want to generate XML from the content of my database.

I will be greatfull to get a help
Thanks

Francis
Tags
General Discussions
Asked by
jerry
Top achievements
Rank 1
Answers by
jerry
Top achievements
Rank 1
Steve
Telerik team
Adam
Top achievements
Rank 1
Francis Frank
Top achievements
Rank 1
Share this question
or