A function is a single ESQL expression that calculates a value from a number of given input values.
A function can take input parameters but has no output parameters; it returns the value that results from implementing the expression to the caller. The ESQL expression can be a compound expression such as BEGIN END.
ESQL provides a number of predefined functions which you can use freely within expressions. You can also declare and use your own functions. You cannot define a function within an EVAL statement or an EVAL function.
When you define a function, you must give it a name. The name is handled in a case insensitive way (that is, use of the name with any combination of upper and lower case letters matches the declaration). This is in contrast to the names that you declare for schemas, constants, variables, and labels, which are handled in a case sensitive way, and which you must specify exactly as you declared them.
Consider the following ESQL program fragment:
SET Diameter = SQRT(Area / 3.142) * 2;
In this example, the function SQRT (square root) is given the value inside the brackets (itself the result of an expression, a divide operation) and its result is used in a further expression, a multiply operation. Its return value is assigned to the variable Diameter. See ESQL functions for information about all the ESQL functions.
In addition, an ESQL expression can refer to a function in another broker schema (defined in an ESQL file in the same or a different dependent project). If you want to use this technique, either fully qualify the function, or include a PATH statement that sets the qualifier. The PATH statement must be coded in the same ESQL file, but not within a MODULE.
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
ak01080_ |