Compartir a través de


Filter Property

Specifies how the data will be filtered.

Syntax

[ sValue = ] TDC.Filter

Possible Values

sValue String expression containing one or more columns and associated criteria. By default, this is set to the empty string—that is, no filtering occurs and all rows are displayed. An invalid expression causes all rows to be returned. If there is no header line that names the columns, they are given default names of Column1, Column2, Column3, and so on. The special wildcard character, *, can be used to match any character.

The property is read/write. The property has no default value.

Remarks

The Filter property restricts the data displayed to the user. You can set this property in the object element's param element to cause initial filtering of the data. You can also use script to set the Filter property, which takes effect when the Reset method is called. The data is fetched only once, so using this property is an efficient way of displaying the same data different ways.

Examples

The following param element filters out database entries that have an empty phone-number field. The special characters used for quotation marks (") denote an empty string.

<PARAM NAME="Filter" VALUE="PhoneNum <> &quot;&quot;">

You can use the wildcard character to match all phone numbers starting with 9, using the following param element.

<PARAM NAME="Filter" VALUE="PhoneNum <> 9*">

Here is a more complex use of the Filter property.

<PARAM NAME="Filter" 
    VALUE="(Quantity > 10 & color = lime) | Quantity < 5">

This code selects rows whose quantity is greater than 10 and whose color is lime, combined with all rows whose quantity is less than five. The exact syntax support by the Filter property is defined below. In essence, any arbitrary expression using the usual relational operators is allowed, including comparisons between fields. AND (&) and OR (|) operators have equal precedence and thus must be surrounded by parentheses if combined.

Complex ::== Simple
 ::== Simple '&' Simple [ '&' Simple ... ]
 ::== Simple '|' Simple [ '|' Simple ... ]
Simple ::== '(' Complex ')'
 ::== Atom Relop Atom
Relop ::== '=' | '>' | '>=' | '<' | '<=' | '<>'
Atom ::== Characters up to a (, ), >, <, =, & or |

If an atom is recognizable as a field name, it is treated as a field name. Otherwise, it's treated as a value. Quotes (") are processed and force the atom to be treated as a value. Escape characters (\) are processed and allow the use of special characters within a field name. It is illegal to attempt a comparison of two columns with different types.

The definition of 'Complex' expressly forbids mixing logical ANDs and ORs (& and |) unless parentheses are used to clarify the query. The following is illegal:

Column1 > 10 & Column3 = lime | Column4 < 5

But the following is allowed:

(Column1 > 10 & Column3 = lime) | Column4 < 5

Applies To

TDC

See Also

Reset, Sort, UseHeader