Using DataWindow expression functions

In the DataWindow painter, you can use DataWindow expression functions in expressions for computed fields, filters, validation rules, and graphed data, with some exceptions.

The dialog boxes in which you define expressions include a list box that lists the available functions and their arguments. The dialog boxes make it easy to insert a function into the expression.

For information about expressions, see DataWindow Operators and Expressions

Return values for functions and expressions

DataWindow expression functions can return the following datatypes:

Double
Decimal
String
DateTime
Time

Within an expression, a function can return other datatypes (such as boolean, date, or integer), but the final value of an expression is converted to one of these datatypes.

Restrictions for aggregate functions

An aggregate function is a function (such as Avg, Max, StDev, and Sum) that operates on a range of values in a column. When you use an aggregate function, some restrictions apply. You cannot use an aggregate function:

  • In a filter

  • In a validation rule

  • As an argument for another aggregate function

When you use aggregate functions, they cancel the effect of setting Retrieve Rows As Needed. To do the aggregation, the DataWindow object always retrieves all rows.

User-defined functions in PowerBuilder

You can include user-defined functions in DataWindow expressions. The datatype of the function's return value can be any of the following: double, decimal, string, boolean, date, DateTime, or time. The function must be defined as a global function so that it is available to the DataWindow object. However, a global function argument of datatype boolean cannot be provided by a DataWindow expression because it does not map to any of the datatypes listed in Return values for functions and expressions.

Built-in DataWindow expression functions cannot be overridden. For example, if you create a global function called Today, it is used instead of the PowerScript system function Today, but it is not used instead of the DataWindow expression function Today.

Formatting for the locally correct display of numbers

No matter what country you are creating objects and developing an application in, you must use U.S. number notation in numbers or number masks in display formats, edit masks, and DataWindow expressions. This means that when you specify a number or number mask, use a comma as the thousands delimiter and period for the decimal place.

Numbers display appropriately in whatever countries you deploy applications in. At runtime, the locally correct symbols for numbers display (because the international Control Panel settings are used) when numbers are interpreted. For example, in countries where comma represents the decimal place and period represents thousands, users see numbers in those formats at runtime.

For information about the locally correct display of dates and day names, see String and DayName.