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

Getting a summary value

Hi again,

I have another GridGroupingControl question, for the same screen as last time.

I want the progress bar in the account targets groupbox to reflect a value based on the sums for the actual % and target % columns in the detail. So, in the given screenshot, I want to be able to calculate ( 0 + 0 ) / ( 5.33 + 10.66 ) = 0. My thought was to create a summary row and set its visibility to false, since I don''t actually want to display that summary. Then, in TableControl_CurrentCellAcceptedChanges (since I only need to update if a value has changed) I want to grab the two sums, calculate my new value, and set the other progress bar to that calculation.

Does this seem like a valid approach? If so, how can I access the two summary values to perform the calculation?

Thanks,
Michael


GGCExpressions0.zip

3 Replies

AD Administrator Syncfusion Team September 20, 2006 07:18 AM UTC

Hi Michael,

You can use the GetSummaries method to get the summary value at the specified Table. Below is a code snippet.

//For MainTable.
GridTable table = this.grid.Table;

//For AnyTable...
GridTable table= this.grid.GetTable("TableName");

int indexofSummaryColumn = 0;

Int32AggregateSummary summary1 = (Int32AggregateSummary) table.GetSummaries()[indexofSummaryColumn];
if(summary1 != null)
{
Console.WriteLine("Sum : " summary1.Sum + "::: Min " + summary1.Minimum + "::: Max " + summary1.Maximum);
}

Let me know if this helps.

Thanks,
Haneef


AD Administrator Syncfusion Team February 2, 2007 03:34 PM UTC

Here how come i come to know that which level group summary i am getting...

I want summary cell value for the group level 2...
I have the group object. Using this group object can i get the summary value?


AD Administrator Syncfusion Team February 2, 2007 08:26 PM UTC

Hi,

Thank you for being patience.

The GroupLevel property can be used to check for the level of the group summary. The Summaries for the group can be retrieved by using GetSummaries method. Please refer to the following code snippet for more details.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// QueryCellStyleInfo event
Group g = el.ParentGroup;
System.Diagnostics.Trace.WriteLine(g.GroupLevel);

ITreeTableSummary[] summaries = g.GetSummaries(g.ParentTable);
SummaryDescriptorCollection sdc = e.TableCellIdentity.Table.TableDescriptor.Summaries;
Int index = sdc.IndexOf(sdc["priceSummary"]);
DoubleAggregateSummary summaryPrice = summaries[index] as DoubleAggregateSummary;

index = sdc.IndexOf(sdc["volumeSummary"]);
Int32AggregateSummary summaryVolume = summaries[index] as Int32AggregateSummary;

string text = indentString + "groupedBy: " + g.CategoryKeys[0].ToString();
text += string.Format(" high:{0:F2} low:{1:F2} volume:{2:F0}", summaryPrice.Maximum, summaryPrice.Minimum, summaryVolume.Sum) + Environment.NewLine;
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon