Creating Custom-Defined Macros

When you create a custom-defined macro, Essbase records the macro definition and stores it in a catalog of macros. You can then use the macro in formulas and calculation scripts until the macro is removed from the catalog.

You can register a custom-defined macro in the following ways:

  • As local, in which the macro is available only in the Essbase application in which it was created

  • As global, in which the macro is available to all Essbase applications running on the Essbase Server where the macro was created

To create a custom-defined macro:

Use the create macro MaxL statement.

The following MaxL statement creates a local macro named @COUNTRANGE for use in the Sample application:

create macro Sample.'@COUNTRANGE'(Any) AS
'@COUNT(SKIPMISSING, @RANGE(@@S))'
spec '@COUNTRANGE(MemberRange)'
comment 'counts all non-missing values';

The following MaxL statement creates a global macro named @COUNTRANGE:

create macro'@COUNTRANGE'(Any) AS
'@COUNT(SKIPMISSING, @RANGE(@@S))'
spec '@COUNTRANGE(MemberRange)'
comment 'counts all non-missing values';