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

XML and datasource

3 Answers 185 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pankaj
Top achievements
Rank 1
Pankaj asked on 02 Apr 2008, 07:18 PM
Hi ,

I am using XML as datasource .
These xml data i am getting from web service.
I am using a Typed datasource and  creating  tables in it.
Now these table i am using as datasource through report wizard datasource object.
I have to implement reporting in both web as well as win application.
Currently i am trying with Windows application.

Now my Questions are.
1. Can i directly pass the XML to report at runtime  and dynamically add the table cotent to report controls.

2. Or can i read data from datatable / dataset and add it to reports details section How?
( I need multiple textboxes or any other control?)

3 Answers, 1 is accepted

Sort by
0
Accepted
Milen | Product Manager @DX
Telerik team
answered on 03 Apr 2008, 09:00 AM
Hi Pankaj,

Yes, you can change the dataset you are using as datasource of the report at runtime.
You just have to create a new dataset, fill it with data (from XML in your case), then assign it to the DataSource property of the report. If you are using a Win viewer to show the report you need to call the RefreshReport() method in order the new data to be shown (the Web viewer does not need such method to refresh the report).

Because the report you are creating is a regular .NET class, you can move this functionality to the report class itself. For example you can write a method in the report that takes XML as a parameter. produces a dataset and assigns it to the DataSource property. Actually, this is the one of the greatest things about our product: you can extend your report as you need coding new functionality to it.

For more information on binding data to reports, you can review the following group of help articles: Connecting Data to a Report.
Also, you can take a look at the articles in the Quickstart section of our help and use them as a kickstart of your project.
Further you can review the Understanding Report Sections article for more information on how to organize the data in your reports.

One last thing. To use your reports both in win and web environment put them in a ClassLibrary project so that you can refer the produced assembly from the applications.

I hope you find this information helpful.

Best wishes,
Milen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Pankaj
Top achievements
Rank 1
answered on 04 Apr 2008, 09:56 AM
Hi,
I the solution you have given is much helpful.
Thanks for it. and I am using the same way as given in help I have created a report library class project.
Now another question is.

1.Can i change the chart types or the grid at run time passing the parameter to report object. I chart type like bar chart or pie chart as user selects and  how?

2. Also for deploying the rad reports do ineed any merge module like in case of crystal report . or I can directly depl;oy it as rad control for windows forms.

Again thanks for the solution.

Pankaj
0
Chavdar
Telerik team
answered on 06 Apr 2008, 06:43 AM
Hello Pankaj,

You can change all the report settings by exposing public properties or methods. For example to change the type of the chart series you can add a SeriesType property to the report definition in the following manner:

    public partial class Report1 : Report
    {
        public Report1()
        {
            /// <summary>
            /// Required for telerik Reporting designer support
            /// </summary>
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        public ChartSeriesType SeriesType
        {
            set
            {
                this.chart1.DefaultType = value;
            }
        }

    }

and do the following in the change series type event handler:

    (this.reportViewer1.Report as Report1).SeriesType = Telerik.Reporting.Charting.ChartSeriesType.Pie;
     this.reportViewer1.RefreshReport();


To deploy Telerik Reporting you need only to copy only the necessary assemblies. More information you can find it this article. No merge module is available at the moment.

Hope this helps. Let me know if you need any further assistance.

Best wishes,
Chavdar
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
Pankaj
Top achievements
Rank 1
Answers by
Milen | Product Manager @DX
Telerik team
Pankaj
Top achievements
Rank 1
Chavdar
Telerik team
Share this question
or