Comparing strings in DataWindow expressions

When you compare strings, the comparison is case sensitive. Leading blanks are significant, but trailing blanks are not.

Case-sensitivity examples

Assume City1 is “Austin” and City2 is “AUSTIN”. Then:

City1=City2

returns false.

To compare strings regardless of case, use the Upper or Lower function. For example:

Upper(City1)=Upper(City2)

returns true.

For information about these functions, see “Using DataWindow expression functions”.

Blanks examples

Assume City1 is "Austin" and City2 is " Austin ". Then the expression:

City1=City2

returns false. DataWindow .NET removes the trailing blank before making the comparison, but it does not remove the leading blank.

To prevent leading blanks from affecting a comparison, remove them with one of the trim functions: Trim or LeftTrim.

For example:

Trim(City1)=Trim(City2)

returns true.

To compare strings when trailing blanks are significant, use an expression such as the following to ensure that any trailing blanks are included in the comparison:

City1 + ">" = City2 + ">"

For information about these functions, see “Using DataWindow expression functions”.