Version

We recommend that you use the xamDataGrid control instead of the xamGrid control. The xamGrid is being planned for retirement over the next few years and will not receive any new features. We will continue to provide support and critical bug fixes for the xamGrid during this time. For help or questions on migrating your codebase to the xamDataGrid, please contact support.

Retrieve the Result of a Summary

You can retrieve a SummaryResult object by indexing into a SummaryResultCollection off the SummaryRowSettings object in xamGrid.

There are different SummaryResultCollection collections available, for example the column layout or the child band collections. The one that is used depends on the value of the SummaryRowSettings/SummaryRowSettingsOverride object’s SummaryScope property.

For more information on column layouts, see the Define Column Layout topic.

The Value property of the SummaryResult object returns the result of the summary. You may need to cast the Value property to the correct data type before using it in your application logic.

The built-in summary calculators will return the following data types:

Summary Calculator * Data Type*

Sum

Decimal

Average

Decimal

Count

Integer

Minimum

Data Type of the Column

Maximum

Data Type of the Column

The SummaryDefinition of the SummaryResult object returns the Column which the summary is executed on, and the SummaryOperand of the summary.

The following example code demonstrates how to retrieve values from the SummaryResult object.

In Visual Basic:

Dim SumResult As Object = Me.MyDataGrid.SummaryRowSettings.SummaryResultCollection(0).Value
Dim SumDefinition As SummaryDefinition = Me.MyDataGrid.SummaryRowSettings.SummaryResultCollection(0).SummaryDefinition
Dim MySummary As SummaryOperandBase = SumDefinition.SummaryOperand
Dim MyColumn As String = SumDefinition.ColumnKey

In C#:

object SumResult = this.MyDataGrid.SummaryRowSettings.SummaryResultCollection[0].Value;
SummaryDefinition SumDefinition = this.MyDataGrid.SummaryRowSettings.SummaryResultCollection[0].SummaryDefinition;
SummaryOperandBase MySummary = SumDefinition.SummaryOperand;
String MyColumn = SumDefinition.ColumnKey;