Devexpress Report Get the Subreport Summary value in Parent Report and display over there

StackOverflow https://stackoverflow.com/questions/21771968

  •  11-10-2022
  •  | 
  •  

Question

Me using Devexpress extra Report and SubReport I Want the sum of Amount to the parent Report Group footer.

E.g.

Detail Section 
           (Sub Report)
                    Item 1  1000
                    Item 2  1500
                    Item 3  1500
                    Item 4  2000

Report Footer 
                    Sum     6000
Was it helpful?

Solution

You should use the Parameters collection to exchange information between reports at runtime.

Following code will help you achieving this:

//Take Summary value from Label1.

private void Label1_SummaryCalculated(object sender, TextFormatEventArgs e) {
   if(e.Value != null)
      oSummaryValue = Convert.ToDouble(e.Value);
}

//Assign value to Parameter 

    private void xafReport1_ParametersRequestBeforeShow(object sender, DevExpress.XtraReports.Parameters.ParametersRequestEventArgs e) {
         xafReport1.Parameters["parameter1"].Value = oSummaryValue ;
    }

//Assign value to label3 in master report

    private void xafReport1_ParametersRequestSubmit(object sender, DevExpress.XtraReports.Parameters.ParametersRequestEventArgs e) {
         label3.Text = xafReport1.Parameters["parameter1"].Value.ToString();
    }   

Please refer to the How to: Create a Master-Detail Report using Subreports documentation article and let me know if you need any clarification.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top