Using DataWindow expressions as property values
When a DataWindow object property’s value can be an expression,
you can make the control’s appearance or other properties depend on
other information in the DataWindow.
A DataWindow expression can include:
-
Operators
-
The names of controls within the DataWindow, especially column
and computed field names -
DataWindow expression functions. Some functions, such as
IsRowNew, refer to characteristics of an individual row -
User-defined functions
Different formats for the
expression
When you assign an expression in the painter, you specify just the
expression:
|
1 |
DataWindowexpression |
When you assign an expression in code, you specify a default
value, a tab, and the expression:
|
1 |
defaultvalue [tab] DataWindowexpression |
Examples
In the painter
This expression for a column called emp_lname is applied to the
Background.Color property. It causes the name’s background to be light
gray (15790320) if the current row (person) uses the day care benefit.
If not, the background color is set to white:
|
1 |
If(bene_day_care = 'Y', 15790320, 1677215) |
In code
The expression assigned to the Background.Color property includes
a default value. Nested quotes complicate the syntax:
PowerBuilder
|
1 |
dw_1.Object.emp_lname.Background.Color = "16777215 ~t If(bene_day_care = 'Y', 15790320, 16777215)" |
JavaScript
|
1 |
dw_1.Modify("emp_lname.Background.Color = "16777215 If(bene_day_care = 'Y', 15790320, 16777215)"); |