Dataset Runtime Properties

Use the Filter page of the Dataset Runtime Properties dialog to apply a filter to a dataset bound to the form.

Filter

You can add dataset columns, form controls, and operators to a filter expression. Commonly-used operators can be added using shortcut buttons below the expression window:

Columns

When Columns is the selection in the left-hand pane of the Expression Editor, the columns in the dataset are made available for selection in the adjacent pane.

You can select columns to include in an expression and filter the rows based on the values in those columns.

Controls

When Controls is the selection in the left-hand pane of the Expression Editor, the controls in the form, and the properties of a selected control, are made available for selection in adjacent panes:

You can build an expression that will alter the appearance or the state of the controls in the form based on a condition you specify.

In scripts, you can update the values of a column based on the value entered in a form. For example:

[SITE_TYPE] = [SiteTypeTextBox.Text]

or

[PROJECT] LIKE '%'+isnull([ProjectSearchTextBox.Text],'') +'%'

Literal Values

In an expression, literal values may be used in comparisons with column values.

  • Literal String values should be enclosed within single quotation marks (occurrences of single quotes within a string value must be prepended with another single quote as an escape character).
  • "[FirstName] = 'John'"

    "[FullName] = 'John O''Groats"

  • Literal Date values should be enclosed within hashes (#) or single quotes (') depending on the data provider. Decimals and scientific notation are permissible for numeric values. For example:
  • "[Birthdate] < #1/31/82#"

For columns that contain enumeration values, cast the value to an integer data type. For example:

"EnumColumn = 5"

Parent-Child Relationships

A parent table may be referenced in an expression by prepending the column name with Parent. For example, Parent.Grade refers to the parent table column Grade.

When a parent has more than one child, the syntax Parent(RelationName).ColumnName is used.

A table column in an only child relationship may be referenced in an expression by prepending the column name with Child. For example:

Sum(Child.Grade) 

will return the sum of the column in the Grade child table.

If there is more than one child, then the Relationship must be specified. For example:

Sum(Child(DrillholeCollars.Grade) 

Operators

When Operators is the selection in the left-hand pane of the Expression Editor, the Arithmetic, Comparison, and Logical (Boolean) operators you can use in a filter expression are made available for selection in the adjacent pane. A subset of commonly-used operators are available as shortcut buttons below the expression window.

Arithmetic

The following Arithmetic operators are supported:

+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus

Note that the Addition operator may also be used to concatenate strings.

Aggregates

Aggregates are usually applied in Master-Detail relationships. Create an aggregate expression by using one of the functions listed earlier and a child table column as detailed in Parent/Child Relation Referencing that was discussed earlier. For example:

Avg(Child.Price)

Avg(Child(Orders2Details).Price)

An aggregate can also be performed on a single table. For example, to create a summary of figures in a column named "Price":

Sum(Price)

Note: If you use a single table to create an aggregate, there is no Group-by functionality. Instead, all rows will display the same value in the column.

The following aggregate types are supported:

Sum (Sum)
Avg (Average)
MIn Minimum)
Max (Maximum)
Count (Count)
StDev (Statistical standard deviation)
Var (Statistical variance)

Comparison

The following comparison operators are allowed:

< Less than
> Greater than
<= Less than or equal
>= Greater than or equal
<> Not equal
= Equals
IN Is a member of the specified set, see “Sets” below.
LIKE Is a match using * or % wildcards, see “Wildcards” below.
BETWEEN Is a numeric or a string value within the specified range, see “Ranges” below.
And

 

 

Boolean Operators (See “Boolean” below)

Or
Not

Wildcards

The wildcard characters * and % may be used interchangeably in a LIKE comparison. If the string in a LIKE clause contains a * or %, those characters should be enclosed in brackets ([]).

A wildcard is allowed at the start and/or the end of a pattern. For example:

AREACODE LIKE '*EAST'

or

[SITE_ID] Like '%'+[TextBox3.Text]+'%'

Note that wildcard characters are not allowed in the middle of a string. For example, the first wildcard example above will find SOUTHEAST and NORTHEAST, however:

'SOUTH*ST'

is not allowed.

Sets

You can test for membership of a set using square brackets to denote a comma-delimited set of values:

AREACODE IN ['SOUTH', 'WEST']

Ranges

You can use square brackets to denote a range of values:

RESULT BETWEEN [1.0, 3.0]

Boolean

Concatenation is allowed using Boolean AND, OR, and NOT operators. These are available on a shortcut button toolbar below the expression window.

The AND operator has precedence over other operators. You can use parentheses to group clauses and force precedence. For example:

(Element = 'Au' OR Element = 'Cu') AND AreaCode = 'SouthEast'

Functions

Convert(expression, type)

Convert an expression to a specified type. For example:

myDataColumn.Expression="Convert(total, 'System.Int32')"

 

LEN

Get the length of a string. For example:

myDataColumn.Expression="Len(ItemName)"

 

ISNULL

Check an expression and either returns the checked expression or a replacement value. For example:

myDataColumn.Expression="IsNull(price, -1)"

 

IIF

Get one of two values depending on the result of a logical expression:

myDataColumn.Expression = "IIF(total>1000, 'expensive', 'dear')

 

SUBSTRING

Gets a sub-string of a specified length, starting at a specified point in the string:

myDataColumn.Expression = "SUBSTRING(phone, 7, 8)"

 

Options