Create Function

The MaxL create function statement helps you create or re-create your own registered Essbase calculation function, using a Java method.

Minimum permission required:

  • Application Manager to create a local (application-level) function.

  • Administrator to create a global (system-level) function.

Process to follow:

  1. Develop the functions in Java classes.

  2. Use create function to register them in the Essbase calculator framework.

  3. You can now use the functions in the same way that you use the standard Essbase calculation functions.

Syntax


Description of crefunc.gif follows
Description of the illustration crefunc.gif

Use create function to create a function in the following ways:

Keywords

create function as

Register with Essbase a custom-defined function developed in Java, either as a global function usable by the entire Essbase Server, or as a local function available to an application. To register a global (server-wide) function, use one token for FUNC-NAME. To register a local (application-wide) function, use two tokens for FUNC-NAME.

create or replace function as

Register with Essbase a global or local custom-defined function. If a function with that name already exists in the custom-defined function and macro catalog, it is replaced.

spec

Enter, for the custom-defined function, an optional Essbase calculator-syntax specification string, such as in the following example: @COVARIANCE (expList1, expList2). Use a specification string if you wish the function to be returned by the output string of the IEssCube.getCalcFunctions Java method or EssListCalcFunctions C API function.

Note:

If you do not specify a calculation specification string, you cannot specify a comment either.

with property runtime

Designate the custom-defined function as a runtime function. Normally, Essbase pre-executes functions whose arguments are available at compilation time. The Runtime property prevents that optimization, executing functions that have constant values as operands (or no operands at all) for every block in the function range. If the built-in @CALCMODE(CELL) function is used, a custom-defined function declared as Runtime can execute on every cell in the range.

Note:

No built-in Essbase calculator functions have the Runtime property.

The Runtime property should be applied only in special circumstances, as it can seriously affect performance. The runtime property might be desirable for any custom-defined function whose return value depends on something besides its arguments; for example, the current date, or values in a rapidly changing relational table. If you created a runtime function @RANDOM() that returns a new random number each time it executes, then a member formula such as "Mem1 = @RANDOM();" would return different values for each block. At compilation time, the Runtime property prevents the pre-execution of functions that are applied to constants.

comment

Create a description of the function (optional). You cannot create a comment without also using spec to create a calculator-syntax specification string. The optional calculator-syntax specification string and the comment are used as the output string of the IEssCube.getCalcFunctions Java method or EssListCalcFunctions C API function.

Notes

  • To create a global or system-level function, use a single name for FUNC-NAME. For example, '@COVARIANCE'.

  • To create a local or application-level function, use MaxL's double naming convention for FUNC-NAME. For example, Sample.'@COVARIANCE'. The second token must be enclosed in single quotation marks because it contains a special character.

Example

CREATE FUNCTION '@COVARIANCE' 
AS 'com.hyperion.essbase.calculator.Statistics.covariance' 
SPEC '@COVARIANCE (expList1, expList2)' 
COMMENT 'computes covariance of two sequences given as expression lists';