DataWindow operators

DataWindow operator precedence

Description

The AND and OR operators in a DataWindow expression have the same precedence in PowerBuilder, but in Appeon, the AND operator has higher precedence.

Workaround

When there are both AND and OR operators in a DataWindow expression, you should use parentheses to get the correct precedence effect.

Example

The following code examples are for a DataWindow expression that sets the column text color. The OR operator will be evaluated first in PowerBuilder, but in Appeon, the following script will evaluate the AND operator first.

Original code:

If(Left(GetText(), 1) = 'V' OR Left(GetText(), 1) = 'A' AND Mod(GetRow(), 2) = 1, 236, 243433) // incorrect

To have the OR operator evaluated first, add a pair of parentheses to the OR expression:

If((Left(GetText(), 1) = 'V' OR Left(GetText(), 1) = 'A') AND Mod(GetRow(), 2) = 1, 236, 243433) // correct