GrapeCity ActiveAnalysis: How to Get User Selected Filter Values
GrapeCity Active Analysis (GCAA) has been in the business of providing ad-hoc analysis solution to end-users and developers alike. Like any other analysis tool it provides various analysis mechanisms to analyze data; and one of the important analysis mechanisms that it provides happens to be Filtering. Filtering plays a pivotal role when performing analytical operations on data, it helps users create subsets of data on which they can perform queries and observe results. GCAA provides various filters which can be applied to both Measures and Attributes. The list of available filters is provided below and description about each filter can be read from here.
- Member Filter
- TopNFilter
- Range Filter
- Value Filter
- Heading
Applying filters to attributes/ measures is just a matter of selecting the filter type and setting the filter values on the Pivot View at run time. The job of displaying the filtered data is handled by the Pivot View itself. The challenge however does not lie in how to apply filtering, but how to get the user selected values. We may need to get the user selected filter values in order to keep track of the filter types that a user may have applied and the filter values that were set by the user. GCAA keeps track of all filters that are applied on the Cube; hence the Filter Card on the Pivot View automatically gets updated with the filter that was applied. GCAA allows users to apply various filters to a Cube and in order to get the list of all filters and the filter value for each filter we need to perform the following steps. Get the List of Filters applied on the Cube: The list of filters can be obtained by using the Filter Property of the ILayoutState interface. This property returns a IList Collection of the Type IFiledFilter. This collection will contain items which will be of the Type: IMemberFilter, IValueFilter, IRangeFilter, TopNFilter or IHeadingFilter. Each interface corresponds to the Filter types that were described above. Get Selected Filter Value for Each Filter Now, that we have information about each filter that was applied to the Pivot View, now we only need to iterate through each of the Filter items and typecast each filter item to its appropriate type. Typecasting each filter to its appropriate type is a necessity as each Filter Type as it own set of methods and properties and we cannot get the selected value for each Filter without typecasting them. Download the samples for complete implementation. GetSelectedFilter C# Sample GetSelectedFilter VB Sample