3.13 Global function
Global functions built into Biz / Browser can be used for expressions . By using global functions, more complicated calculation formulas can be expressed, and in most cases, interactive operations can suppress requests to the server.
Example of global function
sum () Calculates the sum.
avg () Calculates the average.
mid () Extracts a part of the string.
Global functions are similar to the methods of objects, but they are not tied to a particular object and you can write the function name directly in the expression.
In addition to the functions built into Biz / Browser , you can also define application-specific functions.
Not supported by Mobile. Please substitute with Record
package MyPackage {
Function func1 (p1, p2) {
return p1 + p2;
}
}
This example is a function that takes two arguments and returns a sum.
Like global functions, Functions defined within a package are not tied to a particular object. By loading it with the import statement, it can be called regardless of the object scope like a global function.
import MyPackage;
:
var ans = MyPackage.func1 (10, 20);
: