Execute a stored calculation, the stored default 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: Execute
You can run calculations in the following ways using execute calculation.
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 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.
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.