Substitution Variables in Calculation Scripts
Use Essbase substitution variables in calc scripts to reference information that changes frequently.
When you include a substitution variable in a calculation script, Essbase replaces the substitution variable with the value you specified for the substitution variable. Substitution variables are useful, for example, when you reference information or lists of members that change frequently.
You can create substitution variables at the server, application, and database levels. To use a substitution variable in a calculation script, the substitution variable must be available to the calculation script. For example, a database-level substitution variable is available only to calculation scripts within the cube; a server-level substitution variable is available to any calculation script on the server.
In a calculation script, insert an ampersand (&) before a substitution variable. Essbase treats any string that begins with a leading ampersand as a substitution variable, replacing the variable with its assigned value before parsing the calculation script.
For example, in Sample.Basic, to calculate Qtr1 as the current quarter:
-
Create a substitution variable for the current quarter (
&CurQtr
) and assign it the valueQtr1
-
Create a calculation script that uses the
&CurQtr
substitution variable. For example:FIX(&CurQtr) CALC DIM(Measures, Product); ENDFIX
You can also use environment variables as placeholders for user-specific system settings.
Also see Runtime Substitution Variables in Calculation Scripts Run in Essbase.