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
When you assign an expression in the painter, you specify just the expression:
DataWindowexpression
When you assign an expression in code, you specify a default value, a tab, and the expression:
defaultvalue [tab] DataWindowexpression
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:
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
dw_1.Object.emp_lname.Background.Color = "16777215 ~t If(bene_day_care = 'Y', 15790320, 16777215)"
JavaScript
dw_1.Modify("emp_lname.Background.Color = \"16777215 \t If(bene_day_care = 'Y', 15790320, 16777215)\");