Is there any way to apply a filter to a Summary.
E.g. Say I have a grid which lists transactions (positive and negative) grouped by account.
I would like to show only those accounts which have a net positive balance.Currently if I apply a filter I get only the positive transactions (and hence all the accounts with at least one positive transaction).
Many thanks
Charlie
Hi Charlie,
I'm not entirely sure I understand what you are asking.
Do you mean that, when the grid is filtered, you want the summary to update so that it only calculates based on the visible rows?
What kind of summary are you using? Are you using a CalcManager formula? Or one of the built-in summary types?
Mike Saltzman"]What kind of summary are you using? Are you using a CalcManager formula? Or one of the built-in summary types?
I am using custom summary type: SummaryType.Custom
Mike Saltzman"]Do you mean that, when the grid is filtered, you want the summary to update so that it only calculates based on the visible rows?
Not quite, the other way round. If my grid is unfiltered and I want to select only those summaries which have positive values, I would get the following:
Okay, now I'm confused.
If you are using SummaryType.Custom, then you are providing an ICustomSummaryCalculator. So you have complete control over the calculation of the summaries. You can ignore any values you want in your code.
So I don't understand what you are asking.
Sorry Mike, my fault for not being clear enough.
OK. So the summaries are all calculated OK, and don't need to change.
However a user comes along and says "Hey this data is fine, but I want to see only those accounts where the sum of transactions is +ve (i.e. John and Anna). I wanna click on one of those funnel things and filter out all the -ve accounts (ie Dave)."The two accounts that have a positive balance (John and Anna), need to remain and the accounts with a negative balance (Dave) need to be hidden.
I want to go from this:
to this:
and not this:
Okay, I get it now.
So you want to filter out the parent rows based on the summary of the child rows for that parent.
There's no simple built-in filtering to do that. But you could add your own custom filter to the list.
What you do is create a class derived from FilterCondition and override the MeetsCriteria method. This method will pass you a row and you can decide whether the row meets the criteria for the filter or not. In this case, you would examine the row.ChildBands[0].Rows.SummaryValues["summary key"].Value.
To get your custom summary onto the list, you would handle the BeforeRowFilterDropDown event of the grid and add a new item into the ValueList passed into the event. The DataValue of the item would be an instance of your derived FilterCondition class and the DisplayText can be whatever you want.