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

Report + SubReport with Chart = Cache problems

2 Answers 129 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jose Ronaldo
Top achievements
Rank 1
Jose Ronaldo asked on 21 Aug 2008, 11:47 PM
Hi, I create a project with two report's.
One report (the master) contains tabular data and another report (the subreport) with only the Chart.

The problem:
When I run the main report the first time, the tabular data on master report and the chart in subreport shows correctly.

But if I change the parameters on the mater report, only a data in a master report is correctly refresh. The chart of subreport stay with first values. I try copy the Chart to master report without success.

I use a Chart with NeedDatasource event.

My Business with Dataset for Report and Chart Datasource
    public static class BusinessParameters 
    { 
        public static ReportParameter DataInicial { getset; } 
        public static ReportParameter DataFinal { getset; } 
        public static Datasets.DSEnvioRepresentante DSEnvioRepresentante { getset; } 
 
        public static Boolean ParamsOK() 
        { 
            return (DataInicial != null) && 
                   (DataFinal != null) && 
                   (DataInicial.Value != null) && 
                   (DataFinal.Value != null) && 
                   (!String.IsNullOrEmpty(DataInicial.Value.ToString())) && 
                   (!String.IsNullOrEmpty(DataFinal.Value.ToString())); 
        } 
    } 


My Report with Chart (without subreport)
    /// <summary> 
    /// Summary description for EnvioPorRepresentanteA. 
    /// </summary> 
    ///  
    [Description("Envios por Representantes")] 
    public partial class EnvioPorRepresentante : DCReport 
    { 
        public EnvioPorRepresentante() 
        { 
            /// <summary> 
            /// Required for telerik Reporting designer support 
            /// </summary> 
            InitializeComponent(); 
 
            // 
            // TODO: Add any constructor code after InitializeComponent call 
            // 
            this.Visivel = true
            BLL.BusinessParameters.DSEnvioRepresentante = new DocumentCenter.Reports.Datasets.DSEnvioRepresentante(); 
        } 
        private void BindData() 
        { 
            BLL.BusinessParameters.DataInicial = this.ReportParameters[0]; 
            BLL.BusinessParameters.DataFinal = this.ReportParameters[1]; 
            if (BLL.BusinessParameters.ParamsOK()) 
            { 
 
                Datasets.DSEnvioRepresentanteTableAdapters.EnviosPorRepresentanteTableAdapter taEnvioRepresentante = new DocumentCenter.Reports.Datasets.DSEnvioRepresentanteTableAdapters.EnviosPorRepresentanteTableAdapter(); 
                taEnvioRepresentante.ClearBeforeFill = true
                taEnvioRepresentante.FillByData(BLL.BusinessParameters.DSEnvioRepresentante.EnviosPorRepresentante, Convert.ToDateTime(BLL.BusinessParameters.DataInicial.Value), Convert.ToDateTime(BLL.BusinessParameters.DataFinal.Value)); 
            } 
            else 
            { 
                Datasets.DSEnvioRepresentanteTableAdapters.EnviosPorRepresentanteTableAdapter taEnvioRepresentante = new DocumentCenter.Reports.Datasets.DSEnvioRepresentanteTableAdapters.EnviosPorRepresentanteTableAdapter(); 
                taEnvioRepresentante.ClearBeforeFill = true
                taEnvioRepresentante.Fill(BLL.BusinessParameters.DSEnvioRepresentante.EnviosPorRepresentante); 
            } 
        } 
        private void EnvioPorRepresentante_NeedDataSource_1(object sender, System.EventArgs e) 
        { 
            BindData(); 
            (sender as Telerik.Reporting.Processing.Report).DataSource = BLL.BusinessParameters.DSEnvioRepresentante; 
            (sender as Telerik.Reporting.Processing.Report).DataMember = "EnviosPorRepresentante";             
        } 
 
        private void chart1_NeedDataSource(object sender, EventArgs e) 
        { 
            Telerik.Reporting.Processing.Chart chart = sender as Telerik.Reporting.Processing.Chart; 
            chart.DataSource = BLL.BusinessParameters.DSEnvioRepresentante.EnviosPorRepresentante; 
        } 
    } 

2 Answers, 1 is accepted

Sort by
0
Jose Ronaldo
Top achievements
Rank 1
answered on 22 Aug 2008, 05:09 PM
I need help. I don't know what wrong I do.
Anyone can help me?
0
Steve
Telerik team
answered on 25 Aug 2008, 01:58 PM
Hi Jose Ronaldo,

The scenario you describe should be working fine. Can you explain why do you need to have the chart in a subreport and what problems do you have in moving it in the master report? Have you tried debugging the app and see if the chart1_NeedDataSource is fired as expected?

Sincerely yours,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Jose Ronaldo
Top achievements
Rank 1
Answers by
Jose Ronaldo
Top achievements
Rank 1
Steve
Telerik team
Share this question
or