This sample demonstrates the creation of filters at design time.
Interactive Features:
In the Properties window, select TableDescriptor -> RecordFilters to set the filter criteria. This will open the RecordFilterDescriptor Collection Editor, as shown in the following image.
Click Add to add a row filter. In the Name property, select Wins. You can enter the filter expression using the Expression property: [Wins] > 20.
If you want to enter a filter expression using editors,
select Conditions to open the FilterCondition
Collection Editor. Click Add, to add a
filter condition. Select FilterCompareOperator and
specify the compare text.
The display will look like the
image given below.
Close the two collection editor windows and run the sample. Now your
Grid Grouping control will only display records with wins greater than
twenty.
The following is an image of the sample.
List of Valid Filter Expressions
Expressions may be any well-formed algebraic combination of column mapping names enclosed with brackets "[ ]", numerical constants, and literals.
Computations are performed as listed, with Level One operations first. Alpha constants used with match and like should be enclosed in apostrophes ( ' ).
Algebraic and logical operators are listed below.
Expression |
Syntax |
Description |
---|---|---|
Multiplication, Division |
*, / |
Multiplies or Divides first argument by second argument. |
Addition, Subtraction |
+, - |
Adds first argument with second argument or Subtracts second argument from the first one. |
Or |
| | |
Returns 1 if either the first argument or the second argument returns true. |
And |
&& |
Returns 1 if both parameters return true. |
Less Than |
< |
Returns true if first parameter is less than the second one. |
Greater Than |
> |
Returns true if first parameter is greater than the second one. |
Less Than Or Equal |
<= |
Returns true if first parameter is less than or equal to the second one. |
Greater Than Or Equal |
>= |
Returns true if first parameter is greater than or equal to the second one. |
Equal |
= |
Returns true if both arguments have the same value. |
Match |
match |
Returns 1 if there is any occurrence of the right-hand argument in the left-hand argument. For example, [CompanyName] match 'RTR' returns 0 for any record whose CompanyName field does not contain RTR anywhere in the string. |
Like |
like |
Checks if the field starts exactly as specified in the the right-hand argument. For example, [CompanyName] like 'RTR' returns 1 for any record whose CompanyName field is exactly RTR. You can use an asterisk as a wildcard. [CompanyName] like 'RTR*' returns 1 for any record whose CompanyName field starts with RTR. [CompanyName] like '*RTR' returns 1 for any record whose CompanyName field ends with RTR. |
In |
in |
Checks if the field value is any of the values listed in the right-hand operand. The collection of items used as the right-hand should be separated by commas and enclosed with brackets({}). For example, [code] in {1,10,21} returns 1 for any record whose code field contains 1, 10 or 21. [CompanyName] in {RTR,MAS} returns 1 for any record whose CompanyName field is RTR or MAS. |
Between |
between |
Checks if a date-field value between the two values is listed in the right-hand operand. For example, [date] between {2/25/2004, 3/2/2004} returns 1 for any record whose date field is greater or equal to 2/25/2004 and less than 3/2/2004. To represent the current date, use the token TODAY. To represent DateTime.MinValue, leave the first argument empty. To represent DateTime.MaxValue, leave the second argument empty. |