FieldFilter Tag

Purpose

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.

Examples

<GEN:FieldFilter Name=“StartDate”/>

[Application Generation] properties (Iron Speed Designer)

These properties control specific types of controls created by Iron Speed Designer.

Property

Description

Control type

Specifies the type of search filter displayed.

Quick Selector

Quick Selector control displays a button with all selected values. It opens a special Quick Selector page in a modal pop-up when clicked. This page allows easy search and selection of one or multiple values. Search for Quick Selector Page for more information.

DropDownList

The Dropdown List control type displays a list of values retrieved from the database. The list contains all values used in the designated database field.

ListBox

The List box control type displays a list of values retrieved from the database.  The list contains all values used in the designated database field.

TextBox

The Text Box control type displays a text entry box.  Application uses can enter any text, and the associated database table and field will be searched for matching entries.

Database field

Field

Specifies the database field to which the filter applies in the format:

<TABLE>.<FIELD>

Applies To

List Box

Field to filter

Field

Specifies the database field to which the filter applies in the format:

<TABLE>.<FIELD>

Applies To

Quick Selector
Dropdown List
Text Box

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

=

Is equal to

<> 

Is not equal to

>=

Is greater than or equal to

Is less than

<=

Is less than or equal to

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:

CONTAINS

Contains

NOT_CONTAINS

Does not contain

STARTS_WITH

Starts with

NOT_STARTS_WITH

Does not start with

ENDS_WITH

Ends with

NOT_ENDS_WITH

Does not end with

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.

True

Performs a less precise comparison on date fields.

False

Performs a precise comparison on date fields including both date and time.

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.

Applies To

Dropdown List

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.

ASP.NET Properties

See ASP.NET Control Properties for details.

Turning off AutoPostBack on filters

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.

Setting the default time string for date range filters

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”

Obsolete Application Generation Properties (Iron Speed Designer)

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.

Property

Description

Populate filter with

OnlyDisplayMatchableValues

Specifies which items to include in the filter list.

AllPossibleValues

Build the filter list (list of possible values) from a lookup table, typically referenced via a foreign key or virtual foreign key relationship.  The "all possible values" option will always subject all values in the table to the filter.

This option is typically faster because the associated lookup table usually has a small number of values.

ResultSetValues

Build the filter list (list of possible values) from actual data in the filtered table.  Only values in the table will be in the resulting filter list.

This option is typically slower because scanning the filterd table requires a full table scan of the entire table to determine the data values contained in the table.

Note:  The two dropdown filter options may still behave differently even if the table column being filtered is not a foreign key:

The "result set values" option subjects only a subset of the values in the table to the filtering, e.g., when the result set has already been filtered by another filter on the page.

See Also

Code Generation Tags

Code Generation Tag Properties