Finding functions

When calling a function, PowerBuilder searches until it finds a matching function and executes it—the search ends. Using functions with the same name but different arguments is called function overloading. For more information, see “Overloading, overriding, and extending functions and events”.

Unqualified function names

If you do not qualify a function name with an object, PowerBuilder searches for the function and executes the first one it finds that matches the name and arguments. It searches for a match in the following order:

  1. A global external function.

  2. A global function.

  3. An object function and local external function. If the object is a descendant, PowerBuilder searches upward through the ancestor hierarchy to find a match for the function prototype.

  4. A system function.

NoteDataWindow expression functions The functions that you use in the DataWindow painter in expressions for computed fields, filters, validation rules, and graphed data 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.

Qualified function names

You can qualify an object function using dot notation to ensure that the object function is found, not a global function of the same name. With a qualified name, the search for a matching function involves the ancestor hierarchy only (item 3 in the search list above), as shown in the following examples of function calls:

dw_1.Update( )

w_employee.uf_process_list()

This.uf_process_list()

When PowerBuilder searches the ancestor hierarchy for a function, you can specify that you want to call an ancestor function instead of a matching descendent function.

For the syntax for calling ancestor functions, see “Calling functions and events in an object’s ancestor”.