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

Get AggregateResult for a specific column

1 Answer 87 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 03 Sep 2014, 01:58 PM
Hi,
I'm trying to implement the Excel export via spread processing and I can't get the aggregation result for specific columns for my footer row. I don't have groups so I can't use columns[i].GetAggregateResults() and AggregateResult does not have a public property for the column name (aggregateFunction is private and I can't access it with reflection in Silverlight).

I can't use the index of the AggregateResult either since I have to be pretty much generic here and not every column has an AggregateResult. So the only identifier here would be the index of the column or the field name of the column.

Do you have any idea how one could achieve this?

1 Answer, 1 is accepted

Sort by
0
Thomas
Top achievements
Rank 1
answered on 04 Sep 2014, 07:48 AM
Ok, got it figured out:

if (columns[i].AggregateFunctions.Any())
{
  foreach (AggregateFunction function in columns[i].AggregateFunctions)
  {
    var value = aggregateResults[function.FunctionName].FormattedValue.ToString();
     ...
  }
}
Tags
GridView
Asked by
Thomas
Top achievements
Rank 1
Answers by
Thomas
Top achievements
Rank 1
Share this question
or