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

Custom totals/rows on summary

22 Answers 944 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Antonio Ibáñez Oliva
Top achievements
Rank 1
Antonio Ibáñez Oliva asked on 13 Jun 2012, 05:28 PM
Hi,
 I would like to add custom values (string) to summary rows, without using aggregation formulas. Is it possible? I want something like the attached image.

Thanks

22 Answers, 1 is accepted

Sort by
0
Smith
Top achievements
Rank 1
answered on 15 Jun 2012, 04:54 AM
you may put a string as format. It will show your string instead of the format.

i.e.
GridViewSummaryItem item1 = new GridViewSummaryItem("column1", "sub total", GridAggregateFunction.Sum);
0
Antonio Ibáñez Oliva
Top achievements
Rank 1
answered on 15 Jun 2012, 06:50 AM
Hi, the problem is that i don't want to use aggregation options. If i put a second summary row, it doesn't appear and my view definition (columns groups) disappears too.

And i don't know if it is correct to mix aggregation items with non aggretation items on the same column. I have done this:

For the first summary row, SUBTOTAL, i have used the sum aggregation function. then i have added a second summary row, added items with aggregation option to none but it doesn't work.
0
Smith
Top achievements
Rank 1
answered on 15 Jun 2012, 09:49 AM
Hi Antonio,

sorry if I get it all wrong. I assume that you want to use more than 1 aggregation function in one radgridview and it seem you maybe want to use aggregation function and then display your data and then use aggregation function to display grand subtotal again.

as far as I knew, In this case you may work around by use the aggregation function to display string from a string builder on second line and then use manual aggregation function to display total on third line. However, the aggregation function on third line need to calculate behind the scene manually. I think this is not the good answer yet >_<

like this

//summaryrow1
GridViewSummaryItem item1 = new GridViewSummaryItem("column1", "Gross Profit Before Tax", GridAggregateFunction.Sum);

//sb is string builder that concatenate string from other variable.
//summaryrow2
GridViewSummaryItem item1 = new GridViewSummaryItem("column1","Tax", GridAggregateFunction.Sum);
GridViewSummaryItem item2 = new GridViewSummaryItem("column2", sb1.tostring(), GridAggregateFunction.Sum);

//summaryrow3
GridViewSummaryItem item1 = new GridViewSummaryItem("column1", "Gross Profit After Tax", GridAggregateFunction.Sum);
0
Ivan Petrov
Telerik team
answered on 18 Jun 2012, 09:09 AM
Hi Guys,

Thank you both for writing.

Please, find attached a sample project which demonstrates how to achieve this scenario with RadGridView. The example uses the build-in AggregateExpression mechanism to accomplish the calculations needed for the second and third (top-to-bottom) summary row values.

I hope this will be useful. Should you have further questions, I would be glad to help.
 
All the best,
Ivan Petrov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Antonio Ibáñez Oliva
Top achievements
Rank 1
answered on 18 Jun 2012, 12:43 PM
Hi Ivan
Thank you!! It works flawlessly.
0
jamsheer
Top achievements
Rank 1
Veteran
answered on 21 Apr 2017, 12:28 PM

Hi Ivan,
 I have a Radgrid with summery row, where debit and credit has values ,I want to get 'Debit-Credit' at each summery rows.

In the below pic i want to get like (A-B) to 'Balance' of summeryrow of grid.

Thanks 
Jamsheer

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 21 Apr 2017, 01:10 PM
Hello Jamsheer, 

Thank you for writing.  

You can add a custom GridViewSummaryItem for a specific column and control how the calculation is done by overriding the Evaluate method. Additional information is available here: http://testdocs.telerik.com/devtools/winforms/gridview/rows/summary-rows

Alternatively, you can use a calculated column where the expression will be credit - debit. Thus, the summary item for this column will have the desired result.

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
jamsheer
Top achievements
Rank 1
Veteran
answered on 22 Apr 2017, 05:54 AM
Hi Ivan,
    
Thanks 
Jamsheer
0
jamsheer
Top achievements
Rank 1
Veteran
answered on 22 Apr 2017, 06:18 AM

Hi Ivan,
 Its works successfully with new column, But here I cant create  new column,because the answer should become at 'Balance' cells of each SummeryRow of RadGrid

Where I want 'Credit- Debit' of SummeryRow to string variable ,or I want to fill (Credit-Debit) to 'Balance' cells of each SummeryRow of RadGrid

Below pic (A-B) to one variable ,or (A-B) to 'Balance' Cells of SummeryRow of RadGrid

Thanks 
Jamsheer

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Apr 2017, 08:01 AM
Hello Jamsheer, 

Thank you for writing back. 

If you add a calculated column with expression "A-B" the summary row will have the desired value. However, if the "Balance" column contains values which summary needs to display the "A-B" where A and B are values from another column, it is suitable to use a custom GridViewSummaryItem and perform the custom calculation. I have attached a sample project which result is illustrated in the attached screenshot. 

I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
jamsheer
Top achievements
Rank 1
Veteran
answered on 24 Apr 2017, 09:50 AM

Hi Dess,
      Here I am using a RadCheckedDropDownList for multi select value. Where I want all checked values of   RadCheckedDropDownList  to the datatable.

Please Refer how could I add to the datatable the checked values  from the checked list of RadCheckedDropDownList.

I need Like this : ' if(Checkeddrpdwnlist1.checked==true) ' then the value to datatable.
Thanks 
Jamsheer

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Apr 2017, 10:24 AM
Hello Jamsheer, 

Thank you for writing back. 

I would like to note that this forum thread is related to RadGridView. I would kindly ask you to open a new thread with the appropriate Product (e.g. RadCheckedDropDownList for WinForms) and to avoid mixing different subjects in the same thread in future. This will also give you the opportunity to track the different cases easily. Thank you for your understanding.

If you have any additional questions regarding RadGridView in this thread, please let me know. 

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
jamsheer
Top achievements
Rank 1
Veteran
answered on 24 Apr 2017, 12:13 PM

Hi Dess,
      Sorry for the above question, 

Its working good, but getting error at the end part i think its because of my Grid has Group function.

where my grid is grouped by Names.  The error getting at the end row of total sum .

please Refer an example Grouped Grid .
Thanks 
Jamsheer

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Apr 2017, 12:38 PM
Hello Jamsheer, 

Thank you for writing back. 

Following the provided information, I was unable to reproduce the issue you are facing with the latest version. I have attached my sample project. Could you please specify the exact steps how to reproduce the problem so I can investigate the precise case? Thank you in advance. 

I am looking forward to your reply.

 Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
jamsheer
Top achievements
Rank 1
Veteran
answered on 25 Apr 2017, 05:37 AM

Hi Dess,
      Sorry, Hope you didn't get my problem.

 where my showtotal property is true here (this.DgvTrialBalance.MasterTemplate.ShowTotals = true;) , That's because i have one more additional row for getting the total of all group .

I didn't get balance at the showtotal row , Please refer how it can possible.

I briefly explained at the picture below.

Thanks 
Jamsheer

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 25 Apr 2017, 08:55 AM
Hello Jamsheer, 

Thank you for writing back. 

Please refer to the modified project which demonstrates a sample approach how to iterate the child rows for the groups at the master level and calculate the balance. The attached screenshot illustrates the result on my end. Note that this is just a sample approach and it may not cover all possible cases. Feel free to modify it in a way which suits your requirement best.

I hope this information helps. If you have any additional questions, please let me know. 

 Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
jamsheer
Top achievements
Rank 1
Veteran
answered on 25 Apr 2017, 10:23 AM
Hi Dess,
      Its works successfully . 
Thanks 
Jamsheer
0
Hengky
Top achievements
Rank 1
Veteran
answered on 23 Jul 2020, 11:21 AM

Hello Dess ... 

How Are U ? 

long time no see 

Can I ask about fill textbox from summaryrow and hidden the summaryrow

 

Tq

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Jul 2020, 04:53 AM

Hi, Hengky,

According to the provided brief information it wouldn't be easy to understand the complete requirement that you have. Could you please give us some more details about the goal that you are trying to achieve? Once we get better understanding of the required functionality, we would be able to think about a suitable solution and provide further assistance.

Thank you in advance. I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

0
Hengky
Top achievements
Rank 1
Veteran
answered on 24 Jul 2020, 09:48 AM

Hai Dess 

I just need to parsing the value of summarygridrow to textbox 

hope u understand.

 

tq

0
Hengky
Top achievements
Rank 1
Veteran
answered on 24 Jul 2020, 09:53 AM
Hai Dess 
I just need to parsing the value of summarygridrow to textbox 
hope u understand.

tq
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Jul 2020, 11:20 AM
Hello, Hengky, 

If I understand your requirement correctly, you need to extract the summary value and assign it to a text box. 

The following forum post shows a sample approach how you can iterate the GridViewSummaryItems contained in a GridViewSummaryRowInfo and get the value of each item: https://www.telerik.com/forums/to-get-summary-row-values-in-to-variable#6GX04NjH9EW0Lu-ZFjvyqA 

I hope this information helps. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Tags
GridView
Asked by
Antonio Ibáñez Oliva
Top achievements
Rank 1
Answers by
Smith
Top achievements
Rank 1
Antonio Ibáñez Oliva
Top achievements
Rank 1
Ivan Petrov
Telerik team
jamsheer
Top achievements
Rank 1
Veteran
Dess | Tech Support Engineer, Principal
Telerik team
Hengky
Top achievements
Rank 1
Veteran
Share this question
or