Argument Values in Macro Definitions

Specifying an argument set for an Essbase custom-defined macro is only part of creating the macro. You must use the argument values in the macro expansion, which defines what functions the macro performs. Two types of argument variables can be used in a macro definition: numbered argument variables, and argument variable shortcuts.

Using Numbered Argument Variables

In a macro definition, argument variables can be referenced by the order in which they appear in the macro signature. Consider the following example macro signature with three argument variables:

SUM3(single, single, group)

To use the input from this function in the macro definition, you reference the arguments using the argument variables @@1 for the first input parameter, @@2 for the second input parameter, and @@3 for the third input parameter. Thus, using the macro in the preceding example and providing the following input,

SUM3("New York", "New Jersey", @CHILDREN(Products));

results in the macro variables being set to the following values:

@@1 = "New York"@@2 = "New Jersey"@@3 = @CHILDREN(Products)

Use of the optional argument in the macro signature has no effect on which macro variable represents which incoming argument; for example, the input,

Macro signature: SUM3(single, optional, group)
Macro input: SUM3("New York", , @CHILDREN(Products));

results in the macro variables being set to the following values:

@@1 = "New York"@@2 = @_NULL@@3 = @CHILDREN(Products)

Using Argument Variable Shortcuts

You can represent sets of arguments with the variable shortcuts @@S and @@SHx. These shortcuts enable you to specify a set of arguments with one variable, rather than listing a set of numbered variables. Using input from the preceding example, the @@S variable would be set to the following value:

@@S = "New York", @_NULL, @CHILDREN(Products)

Argument variables and shortcuts for custom-defined macros can be used in any order within a macro definition and can be repeated in a macro.