A DataWindow expression is a combination of data, operators, and functions that, when evaluated, results in a value. An expression can include column names, operators, DataWindow expression functions, and constants such as numbers and text strings.
DataWindow expressions are associated with DataWindow objects and reports. You specify them in the DataWindow painter. You can also specify expressions in the Database painter, although these expressions have a slightly different format.
For information about DataWindow expression functions that you can use in expressions, see “Using DataWindow expression functions”, or look up the function you want in online Help.
In a DataWindow object or report, you use expressions in these ways:
Other types of expressions you use
You also use expressions in Quick Select, SQL Select, and the Query painter to
specify selection criteria, and in SQL Select
and the Query painter to create computed columns. In these painters
you are using SQL operators
and DBMS-specific functions, not DataWindow expression operators
and functions, to create expressions.
You can access and change the value of DataWindow data and properties in code. The format for expressions you specify in code is different from the same expression specified in the painter. These differences are described in Chapter 4, “Accessing Data in Code” and Chapter 5, “Accessing DataWindow Object Properties in Code”.
Some of the specific places where you use expressions are described here.
Expressions for computed fields can evaluate to any value. The datatype of the expression becomes the datatype of the computed field:
Expressions for graphs and crosstabs
You can use similar expressions for series and values in graphs
and for columns, rows, and values in crosstabs.
Filter expressions are boolean expressions that must evaluate to TRUE or FALSE:
Validation rules are boolean expressions that compare column data with values and that use relational and logical operators. When the validation rule evaluates to FALSE, then the data in the column is rejected.
In the DataWindow painter When you specify a validation rule in the DataWindow painter, you want to validate the newly entered value. To refer to the newly entered value, use the GetText function. Because GetText returns a string, you also need a data conversion function (such as Integer or Real) if you compare the value to other types of data.
If you include the column name in the expression, you get the value that already exists for the column instead of the newly entered value that needs validating.
In the Database painter When you specify the validation rule in the Database painter, you are defining a general rule that can be applied to any column. Use @placeholder to stand for the newly entered value. The name you use for @placeholder is irrelevant—you can assign the rule to any column that has a datatype appropriate for the comparison.
When you define a DataWindow object, a validation rule assigned to a column is brought into the DataWindow object and converted to DataWindow object syntax. @placeholder is converted to GetText and the appropriate datatype conversion function.
Other columns in the rule You can refer to values in other columns for the current row by specifying their names in the validation rule:
Copyright © 2004. Sybase Inc. All rights reserved. |
![]() |