bs declare functions

Call a function using its name, as follows:

functinoname()

Parameter and return values do not exist in beas script, only variables can be used.

A function ends with returning success or failure. A function returns the <return> variable with value 1 for success or value -1 for afilure.

Three types of functions are available:

Methods or events of standard objects (public function)

User defined instance functions (public function)

Local function

A public function definition is only visible in the window, in which the function is defined. A user defined global function is available after the function is created.

Syntax of the function definition:

global function myworld
[script]
end global

 

To execute this function:

myworld()

 

 

All Events can be registered with defined Names

Example: if you want to execute a script after loading window, you can define this in

global function form_loaded
// Button and Field definition
end global

See Window events,

 

Example: Close Work order

 

Inside global functions you can define local functions. This are only visible inside the global function. You can define the local function on every place.

 

global function form_loaded
for ll_row=1 to <dw_1.rowcount>
  checkRow()
next
 
function checkRow
// Check row <ll_row>
end function
end global

 

Example: Close Work order