The main use for substitution variables is to create a dynamic, easy to use variable which will change with time.. In Essbase, you can use substitution variables in the following places:
Trang 1In the following screenshot you can see how the vehicle totals are correct because
the vehicle dimension has already been calculated:
Jan 2009 Feb 2009 Mar 2009 Qtr 1 2009 Sporty
Reserved
Functional
Flashy
2 Door Sedan
4 Door Sedan
Worker
Player
4X2 Pickup
Muddog
Climber
4X4 Pickup
Total Vehicles
4000 5000 9000 750 1350 2100 12500 350 12850 300 7800 8100 32050
300 7800 8100 4000 5000 9000 750 1350 2100 4000 5000 9000 28200
4000 5000 9000 750 1350 2100 12500 350 12850 300 7800 8100 32050
0 0
0 0
0 0
0 0 0
0 0 0 0
Now that we have the sales rolled up in the vehicle dimension, we can now calculate the Calendar Periods dimension which will roll up the values of the months to the quarters, and then to the years Can you imagine how the numbers would look if we rolled up the Calendar Periods dimension first?
Jan 2009 Feb 2009 Mar 2009 Qtr 1 2009 Sporty
Reserved
Functional
Flashy
2 Door Sedan
4 Door Sedan
Worker
Player
4X2 Pickup
Muddog
Climber
4X4 Pickup
4000 5000 9000 750 1350 2100 12500 350 12850 300 7800 8100
300 7800 8100 4000 5000 9000 750 1350 2100 4000 5000 9000
4000 5000 9000 750 1350 2100 12500 350 12850 300 7800 8100
8300 17800 26100 5500 7700 13200 25750 2050 27800 4600 20600 25200
Trang 2Looking at these examples can also give you a good idea of why it is so important
to correctly set up your dimensions with regards to the Dense and Sparse settings
You can take solace in the fact that this only applies to BSO databases and there are
no Dense or Sparse considerations for ASO databases ASO databases only contain
Sparse dimensions
Using Substitution Variables
One of the coolest things in Essbase is the substitution variable Substitution variables are like global variables that can be defined once and then used anywhere in Essbase
you want to The main use for substitution variables is to create a dynamic, easy to use variable which will change with time Each variable name will have a value associated with it which can be changed (recreated), displayed or deleted
For example, let's say you have a batch job that runs every day In this daily job you are loading data, calculating it, and creating a unit report for the current month
Now, can you guess what should be the value of the substitution variable? You got
it, it is the Month value from the database time dimension You set the value of the
time variable once and you can use it in the SQL statement in your data load rule
file You can also use its value in the FIX statement in a calc script, and in an Essbase database report script When you code any one of these scripts, you use the name of the substitution variable in the statement in place of the actual value
Trang 3In Essbase, you can use substitution variables in the following places:
• Dimension Build or Data load Rules File (used in the SQL interface)
• Calculation Scripts
• Report Scripts
• Outline Formulas
• MDX Queries
• Partition Definitions
Substitution variables can be defined on a server level, application level, or database level These variables can be created using EAS, MaxL scripts, or using API calls and Essbase EssCmd scripts
Some rules while creating the variables are:
• The value of a substitution variable should not exceed 256 bytes or characters
• The substitution variable value should not begin with the ampersand [&]
character, although all other characters are allowed
• The user should have READ access to the application or database which
has the variable and should have ADMINISTRATOR access to read a
variable at the server level
Substitution Variables using EAS
We have talked a lot about the substitution variable, let us now see how to create
a substitution variable using the EAS
1 In EAS, scroll down to your Essbase server and select it
2 Click on Actions | Variables | Variable for <YOUR SERVER NAME>.
3 You should see the New Variable screen as shown:
Trang 44 For a Server level variable you need to select All Appsfrom the Application drop box andall dbsfrom the database drop box
5 For an Application Level variable you need to select your application
from the Application drop box.
6 For a Database Level variable, you first need to select your application
from the Application drop box and then select your database from the
Database drop box.
7 To give a Name to the variable, enter sCurMonth and set the Value
to 200801 Click OK
8 The substitution variable is now created on the server In order to view the
substitution variable, select your Server, Click on Actions | Edit | Variables You will see the Substitution Variables screen as shown:
Trang 59 To edit a variable which is already created, on the Substitution Variables
screen, select the value on the variable you want to change, update the Value and then click on the Set button.
10 To copy a variable, click on the Copy button and the Copy Substitution
Variables screen will be displayed (shown below) Select your Application
then Database from their respective drop-down boxes Next, select the
Variable name checkbox, check on the Overwrite Exiting value and click OK.
To reference a substitution variable from your calc script, you must use the
substitution variable's name preceded by an ampersand (&)
Substitution Variables using MaxL
Now that you are familiar with how to create, drop, and copy a substitution variable using the EAS, let us learn how we can set up a substitution variable at Application, Database, and Server level using the MaxL statement