Execute Calculation

The MaxL execute calculation statement helps you calculate an Essbase database. You can use this statement to run a stored calculation script, a calculation string, or the default calc.

Click here for aggregate storage version

Using this statement, you can execute a particular stored calculation, or the default stored calculation (determined by alter database), or an anonymous (non-stored) calculation string.

Minimum permissions required:

  • For stored calculations (CALC-NAME): Granted access to the calculation.

  • For anonymous calculations (CALC-STRING) and the default calculation: Database Update

Syntax


Description of excalc.gif follows
Description of the illustration excalc.gif

You can run calculations in the following ways using execute calculation.

Keywords

execute calculation <calc-name>

Run the specified stored calculation script.

<calc-name> on database

Run the specified stored calculation script against the specified database.

<calc-string> on <dbs-name>

Run an anonymous calculation, whose body is contained in <calc-string>, against the specified database.

default on <dbs-name>

Run the default calculation against the specified database.

<calc-name> with runtimesubvars <rtsv-list>

Run the specified stored calculation script with the runtime substitution variables specified in RTSV-LIST, which is a string of runtime substitution variables specified as key/value pairs. The string must be enclosed with single quotation marks, and the key/value pairs must be separated by a semicolon, including a semicolon after the last runtime substitution variable in the string and before the terminal single quotation mark. In this example of a runtime substitution variable string, the name and value of four runtime substitution variables are specified (for example, the value of the runtime substitution variable named "a" is 100):

'a=100;b=@CHILDREN("100");c="Actual"->"Final";d="New York";'

The string of runtime substitution variables cannot exceed 64 KB.

Note:

Runtime substitution variables used in a calculation script must be declared in the SET RUNTIMESUBVARS calculation command, with a name and default value. If a different value is declared in the RTSV-LIST, the default value is overwritten at runtime.

If you include a runtime substitution variable in RTSV-LIST that has not been declared in SET RUNTIMESUBVARS, Essbase ignores the undeclared runtime substitution variable (no warnings or exceptions are generated).

Runtime substitution variables that are used in a calculation script can be logged in the application log file, using the ENABLERTSVLOGGING configuration setting. See "Logging Runtime Substitution Variables" in the Designing and Maintaining Essbase Cubes.

If the name of a runtime substitution variable that is declared in the SET RUNTIMESUBVARS calculation command is the same as a runtime substitution variable declared in RTSV-LIST, the value specified in RTSV-LIST overwrites the default value in SET RUNTIMESUBVARS.

Notes

  • A stored calculation can be associated with a specific database in an application (database level), or with an application only (application level). To execute a calculation stored at the application level, you must specify which database in the application to calculate using the on database STRING grammar.

  • A calculation script can reference runtime substitution variables using the with runtimesubvars grammar.

Example

execute calculation Sample.Basic.Calc1;

Calculates the Sample.Basic database using the stored calculation script file named Calc1, which is associated with the database.

execute calculation Sample.Calc2 on database Basic;

Calculates the Sample.Basic database using the stored calculation script file named Calc2, which is associated with the Sample application.

execute calculation
  'SET MSG ERROR;
   CALC ALL;'
on Sample.basic;

Calculates the Sample.Basic database using an anonymous (unstored) calculation string.

execute calculation Sample.Basic.Calc3 with runtimesubvars ‘a=100;b=50;’;

Calculates the Sample.Basic database using the stored calculation script file named Calc3, which is associated with the database, and the specified runtime substitution variables, in which the value of the runtime substitution variable named "a" is 100 and the value of "b" is 50.