The GEN:FieldFilter tag is used to filter a table of records based on the value of a field. The field filter can be bound to a database field of any type including a date field. Applying a filter to a database table displays a subset of the database sorted and displayed in a particular way. For example, the table control displaying the filtered data could contain a subset of records, such as "products that are in stock", or "customers that have purchased goods greater than $1000". A table control could also contain a subset of the information for each item, such as "product name, description and price", but not the dimensions of the product.
A dropdown list filter selects an Employee name. |
Similarly, the order of the columns is specified in the filtered table control as well. In summary, a filter limits the records displayed, and for each table control, you can control which columns are displayed, what order they are displayed in, how wide each column is, how the data is sorted, and what types of records to display.
The filter type displayed depends on the field type:
Field Type |
Filter |
Credit Card Exp. Date |
Date filter with one field and a “Go” button. |
Currency |
Numeric filter with one field and a “Go” button. |
Date |
Date filter with one field and a “Go” button. The calendar date picker will be displayed for a date filter control if the filter is bound to a field whose type is Date and if the Ignore Time option is selected in the Property Sheet. If the Ignore Time checkbox is not selected, then the date picker is not displayed. |
Decimal Number |
Numeric filter with one field and a “Go” button. |
Number |
Numeric filter with one field and a “Go” button. |
Percentage |
Numeric filter with one field and a “Go” button. |
All other fields |
Field selection filter (dropdown combo box). The dropdown filters filter immediately when changed and do not have a Go button |
You can specify the Control Type property for the FieldFilter to be a dropdown list or a text box. If a dropdown is specified, the list of current values will be displayed in the dropdown. The current values are all the values that are in the current query including items that are displayed on subsequent pages. If a text box is specified, the application user can type a text value in the text box. You can also specify the operator to use to compare the text value specified in the text box. For example, to search for any names starting with the typed text string, specify the operator as “begins with”.
This tag requires a binding between it and another control, typically the table that it modifies. You must manually hook up the control to the table in the Property Sheet.
The fields displayed in the FieldFilter are not required to be displayed in the table shown to the user.
<GEN:FieldFilter Name=“StartDate”/>
These properties control specific types of controls created by Iron Speed Designer.
Property |
Description |
||||||||||||||||||||||
Control type |
Specifies the type of search filter displayed. |
||||||||||||||||||||||
Database field Field |
Specifies the database field to which the filter applies in the format: <TABLE>.<FIELD>
|
||||||||||||||||||||||
Field to filter Field |
Specifies the database field to which the filter applies in the format: <TABLE>.<FIELD>
|
||||||||||||||||||||||
Index field
|
Specifies the database field from which the list is populated |
||||||||||||||||||||||
Enter key button ID EnterKeyCaptureToButton |
ID of the button to execute when the ‘Enter’ key is pressed. |
||||||||||||||||||||||
Filter operator FilterOperator |
Specifies the filtering operation to apply. Date / Numeric operators
See Setting the default time string for date range filters. String / Text operators: These filter operators are usually only used with String / Text-type database fields:
Using them with numeric or date fields may not be supported in some cases depending on the field's validation type, display format and storage formats. These operators allow filtering by “fragments” of field values, and these fragments often cannot be parsed or interpreted correctly for fields that use certain types of format strings. For example, using the Contains operator on a date field searching for '12' should work correctly. However, searching for '12/30' may not work correctly, because the '/' isn't actually stored in the database field. |
||||||||||||||||||||||
Ignore time when filtering dates |
If selected, performs a less precise comparison on date fields.
|
||||||||||||||||||||||
Maximum generated items MaxDisplayedValues |
The maximum number of database query values automatically populated in the control. This keeps a filter list from becoming excessively large. If the number of values exceeds the maximum displayed values, only the maximum number are displayed. Unlike FieldValue controls, there is no “More” link created for filter controls. Please note that this setting only works for FieldFilter dropdowns; it does not for FieldValue dropdowns.
|
||||||||||||||||||||||
Time TimeString |
Time of day used when filtering. When using a date range filter on a Table Report page, the default time string used for the filter is 00:00:00 indicating 12 AM. This works well if you are comparing with the “Is greater than or equal to” operator since you want to display all records greater than equal to the date entered by the end user. For the “Is less than or equal to” operator, you can specify a default time string of 23:59:59 (11:59:59 PM). This allows the end user to enter a value for the To Date filter and retrieve all records that occur on or before the entered date. |
||||||||||||||||||||||
Table control to filter |
Indicates the table control to which the filter applies. There may be multiple tables on a page, and at least one table must be selected. |
See ASP.NET Control Properties for details.
The default behavior for dropdown filters created by Iron Speed Designer is to postback an event immediately when a new selection is made. This sometimes becomes inconvenient when there are multiple filters and the end users would prefer to select from multiple filters first, and then press a Go button to begin the process of filtering.
The following example shows the Show Customers Table page built using the Northwind database. The ‘Go’ button is the CustomersSearchButton next to the search area.
First, turn off the AutoPostBack property for each filter in the table panel. Second, send an Event from the CustomersSearchButton (Go button) whenever it is clicked to each of the filters.
Step 1: Select each of the filters in turn and set these properties in the Property Sheet:
Group |
Property |
Value |
Custom properties |
Consumers |
Associated table control |
Behavior |
AutoPostBack |
False |
Bind the events for each filter control. In the Custom Properties dialog, add a “Consumers” property and select the table control to which the search filter belongs. If there is only one table control on the page, it will be selected by default.
Step 2: If you have a “Go” button to start the filtering process, your application must instruct the table control to update itself when the user presses the Go button.
Tab |
Property |
Value |
[Application Generation] |
Button actions |
Apply search and filter to |
[Application Generation] |
Button actions |
Select table control(s) / CustomersTableControl |
Step 3: Build and run your application.
When using a date range filter on a Table Report page, the default time string used for the filter is 00:00:00 indicating 12 AM. This works well if you are comparing with the “Is greater than or equal to” operator since you want to display all records greater than equal to the date entered by the end user.
For the “Is less than or equal to” operator, you can specify a default time string of 23:59:59 (11:59:59 PM). This allows the end user to enter a value for the To Date filter and retrieve all records that occur on or before the entered date.
Step 1: In Design Mode, select the date filter control corresponding to the To date.
Step 2: Set this property in the Property Sheet:
Group |
Property |
Value |
[Application Generation] |
Time |
“23:59:59” |
Your application may contain these properties that are no longer used and are obsolete. In general, most obsolete properties are benign and will not affect your application’s code or run-time operation.
Code Generation Tag Properties