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”/>

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

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

Button actions

Actions

Apply search and filter to

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 Layout Editor, select the date filter control corresponding to the To date.

Step 2:  Set this property in the Property Sheet:

Group

Property

Value

Control

Time

“23:59:59”

See Also

Code Generation Tags

Code Generation Tag Properties