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

Report Calls DataSource/Sprocs as many times as the # of graphs on it

1 Answer 43 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bryan Doan
Top achievements
Rank 1
Bryan Doan asked on 18 Nov 2010, 04:14 PM
Hello there,

I have 8 graphs in a telerik report and each of these graphs is assigned to the same datasource which calls a sproc.  But we did a trace and looks like the report calls this same sproc as many time as the # of graphs on the report.  So currently, I have 8 graphs that is assigned to the same datasource, the report calls this sproc/datasource 8 times (each for a graph).

So for each graph, I see the line this.chart1.DataSource = this.Graph (Graph is the name of the datasource), but of course the # changes from each graph from 1 to 8.  How do fix this?  How do we just call the sproc/datasource 1 time and then feed all the graphs from the data returned from this one call?

Thank you so much for your advice and your help!

-Bryan

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 24 Nov 2010, 10:08 AM
Hi Bryan Doan,

Currently the data is being retrieved for every report data item. The declarative DataSource components don't store the data in order to avoid large memory allocation. Generally large datasets should take a few seconds, thus in most cases retrieving data is not the bottleneck, but the actual rendering. However if in your case retrieving the data is time consuming operation our suggestion is to create a method with some custom logic that will fill a dataset just once and use the charts NeedDataSource event to call your methods and set the datasource as shown in the following code snippet:

private void table1_NeedDataSource(object sender, EventArgs e)
{
    ((Telerik.Reporting.Processing.Table)sender).DataSource = this.getData();
}
   
private void table2_NeedDataSource(object sender, EventArgs e)
{
    ((Telerik.Reporting.Processing.Table)sender).DataSource = this.getData();
}
   
private object getData()
{
    if (this.productCatalogDataSet.ProductCatalogDataSetTable.Count == 0)
    {
        this.productCatalogDataSetTableAdapter1.Fill(this.productCatalogDataSet.ProductCatalogDataSetTable);
    }
   
    return this.productCatalogDataSet.ProductCatalogDataSetTable;
}


Greetings,
Peter
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
Tags
General Discussions
Asked by
Bryan Doan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or