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

Converting XML to Datasource

1 Answer 136 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David Copp
Top achievements
Rank 1
David Copp asked on 04 Feb 2010, 03:57 PM
One of the requirements for converting our existing reports is that they be backwards compatible.  We currently have an assortment of reports that include xsl reports and crystal reports.  Both use xml data as their datasource.  I have looked at several examples in the forums that convert xml to built in classes for report design and how to convert the xml to a dataset at runtime.  None of the examples showed how to do this with multiple level xml shown in the attached example.  Can you help me with converting the attached example for use in a report.  And, is there a simple way to do this?  I have hundreds of reports to convert.

Thank You for your help

Here is the xml example:

<creditreport ReportCategory="2" ReportType="2" ReportTitle="Credit Summary Report" ExposureDate="Most Recent" Associate="All Business Associates" CreditExposureProfile="All Contracts" PhysicalExposure="Length of Contract" FinancialExposure="Length of Contract" Note="Note Field" CreatedDate="12/12/2005 10:23:30 AM">
 <associate SellerID="29" AssociateID="EA0452AB-873A-485F-A81A-6174EB65D4E2" AssociateName="Bill's Test" ExposureDate="12/6/2005">
  <profile BeginningBalance=".00" BuyerCreditLimit="No Credit" EstimatedValue=".00" AvailableCredit="No Credit" />
  </associate>
 <associate SellerID="29" AssociateID="F8C42696-9F6C-4876-B7FF-BE673313DE30" AssociateName="BP" ExposureDate="12/6/2005">
  <profile BeginningBalance="100000.00" AssociateID="F8C42696-9F6C-4876-B7FF-BE673313DE30" CreditProfileID="52D0EC5D-857B-4560-9A8B-BDF496FABEB1" ProfileName="1,000,000 LC" BuyerCreditLimit="1000000" EstimatedValue="2273096.11" AvailableCredit="-1273096.11" />
  <profile BeginningBalance="200000.00" AssociateID="F8C42696-9F6C-4876-B7FF-BE673313DE30" CreditProfileID="CD4612B0-A30D-4D49-A972-CEDD52695318" ProfileName="Default Contracts" BuyerCreditLimit="5000000" EstimatedValue="1174770.40" AvailableCredit="3825229.60" />
  </associate>
 <associate SellerID="29" AssociateID="2E63F5E4-5DF2-4609-9046-0CC25B33AC49" AssociateName="Duke" ExposureDate="12/6/2005">
  <profile BeginningBalance="300000.00" AssociateID="2E63F5E4-5DF2-4609-9046-0CC25B33AC49" CreditProfileID="6DAB56EB-6D39-4F1B-A654-D9E651D536EA" ProfileName="Default" BuyerCreditLimit="500000" EstimatedValue="30307948.20" AvailableCredit="-29807948.20" />
  <profile BeginningBalance="400000.00" AssociateID="2E63F5E4-5DF2-4609-9046-0CC25B33AC49" CreditProfileID="9C559583-291F-411A-8E09-C0F7DF1ADFB5" ProfileName="No Credit" BuyerCreditLimit="No Credit" EstimatedValue="-246830681.93" AvailableCredit="No Credit" />
  <profile BeginningBalance="500000.00" AssociateID="2E63F5E4-5DF2-4609-9046-0CC25B33AC49" CreditProfileID="BF9A2D43-E227-4488-A016-2787001EFE71" ProfileName="Unlimited" BuyerCreditLimit="Unlimited" EstimatedValue="2640000.00" AvailableCredit="Unlimited" />
  </associate>
  </creditreport>

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 10 Feb 2010, 09:39 AM
Hi David Copp,

As you have probably noticed, Telerik Reporting does not provide its own data layer but depends on the existing .NET objects (DataSet, Data Table, DataView, ADO.NET, lists - for more information on report data binding, please, refer to this help topic). So preparing and feeding the data to the report is basically up to the developer.

When we have an xml element with text and attribute then this xml element is not represented as a table-column inside DataSet object but as a new table with two data-columns (one for attribute data and other for the element's text) and one key-column (to make relation with it's master table inside DataSet object).

Keeping this in mind we should not use the xml elements with text and arguments because this will introduce one more (slave/detail) table in DataSet i.e in order to represent this in Telerik Report you would have to use either a SubReport or Table items.

More about usage of DataSet with Xml file can be found here. Some useful information about Xml elements and attributes can be found here.

All the best,
Peter
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
General Discussions
Asked by
David Copp
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or