FlexPivot allows you to filter and display data in a specified range. When you apply the range filter, it allows you to filter data based on some condition(s). For example, let's say a company wants to view sales of their products in different countries for the complete year 2014. For this, they needs to slice the Country field in the database using range filters as shown in the following image.
The image given below shows a FlexPivotGrid displaying the sales of all the products ordered in the year 2014.
Complete the following steps to implement range filtering in the FlexPivotGrid control. This implementation uses the sample created in Quick Start topic.
To apply the range filter programmatically for the above discussed scenario using the C1FlexPivotFilter class, use the following code:
C# |
Copy Code
|
---|---|
//Apply range filter to show only some dates C1.FlexPivot.C1FlexPivotFilter rangefilter = fpEngine.Fields["OrderDate"].Filter; rangefilter.Clear(); rangefilter.Condition1.Operator = C1.FlexPivot.ConditionOperator.GreaterThanOrEqualTo; rangefilter.Condition1.Parameter = new DateTime(2014, 1, 1); rangefilter.Condition2.Operator = C1.FlexPivot.ConditionOperator.LessThanOrEqualTo; rangefilter.Condition2.Parameter = new DateTime(2014, 12, 31); rangefilter.AndConditions = true; |