Thread ID:

Created:

Updated:

Platform:

Replies:

Hi,
I''m trying to create a custom summary that provides a weighted average. In the ISummary:CreateSummaryMethod() of my custom summary implementation I need way of accessing a field that isn''t the field being summarized. Is it possible to do this?
Thanks,
Ben.

Hi Ben,
you can access any field (or multiple fields) from the record.
See this example:
public static ISummary CreateSummaryMethod(SummaryDescriptor sd, Record record)
{
object obj = record.ParentTableDescriptor.Fields["Weight"].GetValue(record);
// -or -
// you could also access values from outside the table here, e.g. a external table
// of weights. You only need to make sure then that if you change values in the external table
// that you then call InvalidateSummariesTopDown on the grids Table object.
bool isNull = (obj == null || obj is DBNull);
if (isNull)
return Empty;
else
{
double val = Convert.ToDouble(obj);
return new TotalSummary(val);
}
}
Stefan

Hi,
Could you please post the implementation of the weighted average custom summary? I am having problems getting it to work because the docs don''t describe how to use custom summary delegates..
>Hi Stefan,
>
>Implemented this and it does exactly what I need.
>
>Many thanks,
>
>Ben.