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

2 posts, 0 answers
  1. Bryan Doan
    Bryan Doan avatar
    14 posts
    Member since:
    May 2010

    Posted 18 Nov 2010 Link to this post

    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!

  2. Peter
    Peter avatar
    1631 posts

    Posted 24 Nov 2010 Link to this post

    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)
        return this.productCatalogDataSet.ProductCatalogDataSetTable;

    the Telerik team
    Get started with Telerik Reporting with numerous videos and detailed documentation.
Back to Top