Create variables at the server level Server level variables can be created by the use of ALTER statement.. Syntax: ALTER SYSTEM ADD/SET/DROP VARIABLE • VARIABLE-NAME: Name of the variabl
Trang 1Steps to Execute MaxL from the EAS Editor:
1 Within EAS, click on File | Editor | MaxL Script Editor.
2 The MaxL editor will be opened
3 Variables can be defined at the Server, Database, and Application level
Create variables at the server level
Server level variables can be created by the use of ALTER statement
Syntax:
ALTER SYSTEM ADD/SET/DROP VARIABLE
• VARIABLE-NAME: Name of the variable
• STRING: Value for the variable
Example:
• Create Variable: alter system add variable 'varSystem' '200801';
• Edit Variable: alter system set variable 'varSystem' '200802';
• Delete Variable: alter system drop variable 'varSystem';
Create variables at the application level
Using the ALTER command at the application level, we can create, edit, or delete
a substitution variable
Syntax:
ALTER APPLICATION [APPLICATION-NAME] ADD/SET/DROP VARIABLE
• VARIABLE-NAME: Name of the variable
• STRING: Value for the variable
Example:
• Create Variable: alter application ESSCAR add variable 'varAppl'
'ESSCAR1';
• Edit Variable: alter application ESSCAR set variable 'varAppl'
'ESSCAR';
• Delete Variable: alter application ESSCAR drop variable 'varAppl';
Trang 2Create variables at the database level
Using the ALTER command at the database level, we can create, edit, or delete
a variable
Syntax:
ALTER DATABASE APPLICATION-NAME.DATABASE-NAME ADD/SET/DROP
VARIABLE
• VARIABLE-NAME: Name of the variable
• STRING: Value for the variable
Example:
• Create Variable: alter database ESSCAR.ESSCAR add variable
'varAppDB''ESSCAR1';
• Edit Variable: alter application ESSCAR set variable
'varAppDB''ESSCAR';
• Delete Variable: alter application ESSCAR drop variable
'varAppDB';
Using Maxl, if you want to create a variable which has a double quote in it, define it as shown below:
alter database 'ESSCAR'.'ESSCAR' add variable 'varDQ' '"TestDQ"';
Displaying the Substitution Variable and its value
To display a substitution variable, the display MaxL statement will be used
Syntax:
display variable
all
variable name
on applicationAPPLICATION-NAME
on databaseDATABASE-NAME
on system
Trang 3display variable all;
• variable name: Displays the variable with the Variable Name statement
For Server level Variables, you should just give the Variable-Name statement,
for Application level variables, you should code Application-Name
Variable-Name and for variables declared at the database level only, you
should code Application-Name.Database-Name.Variable-Name
Example:
display variable 'VARSYSTEM';
display variable 'ESSCAR'.'ESSCAR'.'VARAppDB';
display variable 'ESSCAR'.'varAppl';
• on application: Displays all of the variables which are defined for
that application
Example:
display variable on application 'ESSCAR';
Trang 4• on database: Displays all of the variables which are defined on the Database
Example:
display variable on database 'ESSCAR'.'ESSCAR';
Displaying the Substitution Variable in the
SQL editor
As we have discussed earlier, substitution variables can be used in most of the
Essbase editors or API programming statements
We would quickly like to demonstrate how we can use the substitution variable
in the Essbase SQL interface As you know, sometimes you are required to build a
cube only for a particular month and the month may vary depending on the user's
request Instead of changing the SQL code for every request we can actually create
a varMonth variable and pass this variable in the SQL
To call this variable in the SQL interface, you need to say &Substitution-variable (@VarMonth) as shown:
Trang 5Check it out, you can use the substitution variable from the Calculation Script
Editor, or any other script or object that executes in Essbase.
Building your first Calculation Script
The name of this section gives you the impression that we will be discussing Essbase database calculation scripts, exclusively What you learn here is also about 95%
applicable to coding database outline member formulas as well As mentioned earlier
in this chapter, aside from a few member set functions and the FIX and EXCLUDE
commands, almost everything that you can code in a database calculation script can
be coded in a database outline member formula
To begin with, open the Calculation Script Editor in EAS by drilling down to your
Essbase database like Essbase Server | Application | Database, then right-clicking
on Calculation Scripts and then selecting the Create calculation script option You will now see the Calculation Script Editor as shown earlier in this chapter.
Take a close look at the editor itself Notice the various options that help simplify the calculation script writing process on the left side First up is a checkbox allowing you
to view the database outline using the database outline member aliases instead of the database outline member names There is also a list box that allows you to select the outline alias table, should you have more than one created for your database outline The next feature is a great help when writing a calculation script What you see
under the alias table selection area is a simplified representation of the database
outline When you click on an outline member, its name is placed in the script
wherever you placed the cursor
Underneath the outline feature are two check boxes If you check Insert arguments,
when you click on an argument, listed near the bottom it will place the calculation
argument into the calculation script wherever you place the cursor If you check
the Enable Auto-completion, the editor will offer you the choice of automatically
completing the statements you are typing, much like a Microsoft Visual Basic editor Finally, at the bottom is a visual tree representation of all of the available database
calculation functions and commands If you have the Insert arguments checkbox
checked, the editor will place the argument you click into your calculation script
wherever you have placed your cursor