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:

Different formats for the expression

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

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:

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)\");