We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Summary Rows Calcaulation

i have 3 summary row, e.g: sumrow1(sum if col["DataeType"]=1) : 10 20 30 sumrow2(sum if col["DataeType"]=2) : 5 10 3 i want to add a summary row sumrow3(sumrow2/sumrow1):0.2 0.5 0.1 how can i do? Thanks!

8 Replies

AD Administrator Syncfusion Team June 21, 2005 04:45 AM UTC

Cradle, for the first two summary rows you need to create a custom summarydescriptor. See the CustomSummaries example for creating custom summaries. In the ctor for the custom symmary you can check for the criteria you have, e.g. "if (col["DataType"] = 1) and return the corret value for that specific row. For the third row, you should create an empty third GridSummaryRowDescriptor. This will reserve space for an empty row below the two summary rows. To fill this row with cell values you can use QueryCellInfo and assign the cell value to e.Style.CellValue together with additional formatting. This is similar to what is shown in the CustomSectionInGroup example, in its gridGroupingControl1_QueryCellStyleInfo method. But instead of checking for if (el is ExtraSection) you should check for GridSummaryRow sr = el as GridSummaryRow; if (sr != null && sr.SummaryRowDescriptor == "nameOfyourThirdSummaryRow") Stefan >i have 3 summary row, >e.g: >sumrow1(sum if col["DataeType"]=1) : 10 20 30 >sumrow2(sum if col["DataeType"]=2) : 5 10 3 > >i want to add a summary row > >sumrow3(sumrow2/sumrow1):0.2 0.5 0.1 > >how can i do? >Thanks! >


AD Administrator Syncfusion Team July 19, 2005 03:51 PM UTC

For the third row, in gridGroupingControl1_QueryCellStyleInfo Method ,Can u give me more code for it? GridSummaryRow sr = el as GridSummaryRow; ??????


AD Administrator Syncfusion Team July 19, 2005 04:10 PM UTC

How to create an empty third GridSummaryRowDescriptor? >Cradle, > >for the first two summary rows you need to create a custom summarydescriptor. See the CustomSummaries example for creating custom summaries. > >In the ctor for the custom symmary you can check for the criteria you have, e.g. "if (col["DataType"] = 1) and return the corret value for that specific row. > >For the third row, you should create an empty third GridSummaryRowDescriptor. This will reserve space for an empty row below the two summary rows. > >To fill this row with cell values you can use QueryCellInfo and assign the cell value to e.Style.CellValue together with additional formatting. This is similar to what is shown in the CustomSectionInGroup example, in its gridGroupingControl1_QueryCellStyleInfo method. But instead of checking for > if (el is ExtraSection) >you should check for > >GridSummaryRow sr = el as GridSummaryRow; >if (sr != null && sr.SummaryRowDescriptor == "nameOfyourThirdSummaryRow") > > >Stefan > >>i have 3 summary row, >>e.g: >>sumrow1(sum if col["DataeType"]=1) : 10 20 30 >>sumrow2(sum if col["DataeType"]=2) : 5 10 3 >> >>i want to add a summary row >> >>sumrow3(sumrow2/sumrow1):0.2 0.5 0.1 >> >>how can i do? >>Thanks! >>


AD Administrator Syncfusion Team July 19, 2005 07:39 PM UTC

Hi Cradle, The following code will add an empty one to the SummaryRows collection: this.gridGroupingControl1.TableDescriptor.SummaryRows.Add(new GridSummaryRowDescriptor("Empty")); Stefan >How to create an empty third GridSummaryRowDescriptor? > >>Cradle, >> >>for the first two summary rows you need to create a custom summarydescriptor. See the CustomSummaries example for creating custom summaries. >> >>In the ctor for the custom symmary you can check for the criteria you have, e.g. "if (col["DataType"] = 1) and return the corret value for that specific row. >> >>For the third row, you should create an empty third GridSummaryRowDescriptor. This will reserve space for an empty row below the two summary rows. >> >>To fill this row with cell values you can use QueryCellInfo and assign the cell value to e.Style.CellValue together with additional formatting. This is similar to what is shown in the CustomSectionInGroup example, in its gridGroupingControl1_QueryCellStyleInfo method. But instead of checking for >> if (el is ExtraSection) >>you should check for >> >>GridSummaryRow sr = el as GridSummaryRow; >>if (sr != null && sr.SummaryRowDescriptor == "nameOfyourThirdSummaryRow") >> >> >>Stefan >> >>>i have 3 summary row, >>>e.g: >>>sumrow1(sum if col["DataeType"]=1) : 10 20 30 >>>sumrow2(sum if col["DataeType"]=2) : 5 10 3 >>> >>>i want to add a summary row >>> >>>sumrow3(sumrow2/sumrow1):0.2 0.5 0.1 >>> >>>how can i do? >>>Thanks! >>>


AD Administrator Syncfusion Team July 20, 2005 01:02 PM UTC

Can u give me demo code in gridGroupingControl1_QueryCellStyleInfo for this question? To fill this row with cell values you can use QueryCellInfo and assign the cell value to e.Style.CellValue together with additional formatting. This is similar to what is shown in the CustomSectionInGroup example, in its gridGroupingControl1_QueryCellStyleInfo method. But instead of checking for if (el is ExtraSection) you should check for GridSummaryRow sr = el as GridSummaryRow; if (sr != null && sr.SummaryRowDescriptor == "nameOfyourThirdSummaryRow")


AD Administrator Syncfusion Team July 20, 2005 07:11 PM UTC

Here is a little sample showing an empty summary row being populated using QueryCellStyleInfo. http://www.syncfusion.com/Support/user/uploads/GGC_Unbound_88185b74.zip


AD Administrator Syncfusion Team July 21, 2005 03:10 AM UTC

Unbound field is null (My version is 2.0.5.1) i have 3 summary row, e.g: sumrow1(sum if col["DataeType"]=1) : 10 20 30 sumrow2(sum if col["DataeType"]=2) : 5 10 3 i want to add a summary row sumrow3(sumrow2/sumrow1):0.2 0.5 0.1 how can i do it? Thanks! >Here is a little sample showing an empty summary row being populated using QueryCellStyleInfo. > >http://www.syncfusion.com/Support/user/uploads/GGC_Unbound_88185b74.zip > > >


AD Administrator Syncfusion Team July 21, 2005 10:25 AM UTC

At last,I resoved it by using custom Summary

Loader.
Live Chat Icon For mobile
Up arrow icon