SearchFilter Tag

Purpose

The GEN:SearchFilter tag searches for a text string within a table of records, allowing application users to search data in the displayed table.  The resulting table control shows matching records.  The search control is added automatically to any Table Report page where one or more fields (table columns) are designated as being searchable.

The search control is automatically added to any table where one or more data fields have been designated as “searchable” by the application developer.

The SearchFilter tag displays a text box for the application user to enter a value to be searched.  The search can be performed against any field in a table using a comparison operator.  Only designated columns are searched by the search control.

If the control type is a text box, then the control must be bound to a button.  When the button is pressed, the value entered by the application user is searched for within the table.

This tag requires a binding between it and another control, typically the table that it modifies.  You must manually connect the control to the table in the Property Sheet.

The fields searched by the SearchFilter are not required to be displayed in the table shown to the user.

Interactive Search Feature

One of the principal features of the search controls is the interactive search feature.  Interactive search provides list of suggestions after you type several characters.  It fetches list of suggestions by sending request to a web service in the page’s code-behind file which in turn queries the database for a matching set of records.

The interactive search feature has several constraints:

Interactive search is controlled by several properties.

Examples

<GEN:SearchFilter Name=“Search”/>

[Automatic Type Ahead] properties (Iron Speed Designer)

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

Property

Description

Automatic type ahead

AutoTypeAhead

Enables automatic type-ahead search. Auto type ahead does not apply to binary fields such as a Word document.

True

Enables the interactive search feature.

False

Disables the interactive search feature.  False is assumed if this property property is not present.

Delay before fetching

AutoTypeAheadDelay

The time, in milliseconds, that must pass before the Automatic Type Ahead feature fetches suggestions from the database.  The value may be any integer greater than 0.

The default value is “Default” which represents the value specified in the Application Generation Options dialog.  If the property is not present, then “Default” is assumed.

Matched string display

AutoTypeAheadDisplayFoundText

Specifies how to display matched text strings.

AtBeginningOfMatchedString

Displays strings starting from the word where the search text is found.

InMiddleOfMatchedString

Displays some text before the word where search text is found and some text after the word where search text is found.

AtEndOfMatchedString

Displays the text string upto and including the word where the search text is found.

Maximum list size

AutoTypeAheadListSize

The maximum number of suggestions returned from the database by the Automatic Type Ahead feature.

The default value is “Default” which represents the value specified in the Application Generation Options dialog.  If the property is not present then “Default” is assumed.

Minimum number of characters

AutoTypeAheadMinChars

The minimum number of characters that must be entered (typed) into the search control before Automatic Type Ahead fetches suggestions from the database.

The default value is “Default” which represents the value specified in the Application Generation Options dialog.  If the property is not present, then “Default” is assumed.

Search method

AutoTypeAheadSearch

Specifies how to search within text strings.

WordsStartingWithSearchString

Search for words beginning with the text entered in the search control’s text box containing words beginning after the separation characters specified in AutoTypeAheadWordSeparationCharacters.

AnyWhereInString

Search for text starting anywhere in the field.

Default

Use the value specified in the Application Generation Options dialog.

The default value is “WordsStartingWithSearchString”.

Word separators

AutoTypeAheadWordSeparators

Specifies a regular expression representing non-alphabetic characters that form a word boundary.  AutoTypeAheadWordSeperators works only when the “Search method” property is “WordsStartingWithSearchString”.

The default value is [^a-zA-Z0-9].  Iron Speed Designer does not validate this string for syntactic correctness, so please be careful when changing the value.

[Search] properties (Iron Speed Designer)

Property

Description

Case sensitive

CaseSensitive

Indicates whether the search should be case sensitive.

True

Perform a case-sensitive text search.

False

A case-sensitive search is not performed.

Filter operator

Operator

The type of search operation to apply to the selected database fields.

Is Equal To

An exact match is required.

Microsoft SQL Server only.  If the underlying database field selected for the search operation is a Microsoft SQL Server 'char' data type, the actual value stored includes blanks padded at the end of the string.  As such, text strings entered into the search control will not match the char data type field, because the search control strips the trailing spaces from the search string.

CONTAINS

The database field must contain the search string.

STARTS_WITH

The database field must start with the search string.

ENDS_WITH

The database field must end with the search string.

Search fields

Fields

Specifies the database fields to be searched.

Table control to search

Indicates the table control to which the search 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.

Interactive search feature caveats

The width of the suggestion list box is governed by Columns property for the SearchArea text box.  The default value is 50 characters.

When interactive search is enabled (AutoTypeAhead is ‘True’) and the SearchArea control’s operator is set to “EqualsTo”, the feature attempts to find records whose values start with the typed text.

When interactive search is disabled and the SearchArea control’s operator is set to “EqualsTo” (Operator is ‘EqualsTo’), the feature attempt to find records where the data is equal to the typed text.

When search text is typed into a search control, the interactive search feature returns a list of suggestions.  The suggestion item’s length may not be equal to the length specified by ‘Columns’ property if the suggestion item contains new line.  If a suggested item contains new-line characters before the search text then it displays text after new line.  If it contains a new-line after the search text then the text is displayed upto the new line.

For URL fields, the interactive search works only if the complete string ‘http://’ is typed or if the URL is typed without ‘http://’.

See Also

Code Generation Tags

Code Generation Tag Properties

Part II: Configuring Full Text Search