FUNCTION Structure

[resulttype] funcname ( parameterlist ) := FUNCTION

code

RETURN retval;

END;

resulttypeThe return value type of the function. If omitted, the type is implicit from the retval expression.
funcname

The ECL attribute name of the function.

parameterlistA comma separated list of the parameters to pass to the function. These are available to all attributes defined in the FUNCTION's code.
codeThe local attribute definitions that comprise the function. These may not be EXPORT or SHARED attributes, but may include actions (like OUTPUT).
RETURNSpecifies the function's return value expression--the retval.
retvalThe value, expression, recordset, row (record), or action to return.

The FUNCTION structure allows you to pass parameters to a set of related attribute definitions. This makes it possible to pass parameters to an attribute that is defined in terms of other non-exported attributes without the need to parameterise all of those as well.

Side-effect actions contained in the code of the FUNCTION must have definition names that must be referenced by the WHEN function to execute.

Example:

See Also: MODULE Structure, TRANSFORM Structure, WHEN