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:
-
A global external function.
-
A global function.
-
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. -
A system function.
DataWindow 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:
|
1 2 3 |
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 descendant function.
For the syntax for calling ancestor functions, see Calling functions and events in
an object’s ancestor.