Again, if you are extracting the data from Essbase with your report script simply for flat file export purposes, you do not need to worry much about member names... Also, it must be note
Trang 1Member names and aliases
This set of commands allows you to pick and choose what member alias tables to use for the display of member names Again, if you are extracting the data from Essbase with your report script simply for flat file export purposes, you do not need to worry much about member names
OUTALTSELECT
Syntax:
<OUTALTSELECT AliasTableName
Example:
<OUTALTSELECT Display
This command tells Essbase to output the data from this point forward in the script
using the member names from the Display alias table All rows of data returned will have member alias names that are stored in the Display alias table.
Building your first Essbase report script
Hopefully your brain hasn't fallen out yet There's still so much to do We are now
going to build a simple Essbase report script from scratch As described previously,
navigate your way to the Essbase Report Script Editor in your EAS console.
Go ahead and open a new and empty Report Script Click on File | Save and let
Essbase save your report script in the default location with the name of test.rep
The first thing we need to know is the comment identifier In any Essbase report
script, a double forward slash // tells Essbase to ignore that line This is how you
begin a comment line The double forward slash must begin in column 1 of the
file with multiple rows all beginning with the //
For example, a single line comment would look like this:
// This is a comment line.
A comment block with multiple lines would look like this:
// This is a comment block.
// It has several lines in it
Trang 2Also, it must be noted that if you are using a report script to create an actual report
which will be printed and viewed by others, then your report script can be long and complicated and perform several tasks at once If you recall, we mentioned earlier
that some types of commands can be used more than once is a script Well, the
exclamation point is the delimiter that tells Essbase that a series of commands is over, and the next set of commands begins a new part of the report You also end a report script with !, also known as a bang This lets Essbase know it has finished
Of course, if you're using the report script to generate a flat file extract to ship
downstream somewhere, then you will only use ! once and only at the end of
the report script
Let's begin writing our simple Essbase report script If you have your Esscar database outline set up the way we instructed you earlier in this book, you should be able to
code the test.rep report script exactly as shown Please enter into the report script editor the following code and comments:
//Define page members
<PAGE ("Total Market","METRIC")
//Define column members
<COLUMN ("Calendar Periods")
//Define row members
<ROW ("Total Vehicles")
//Select specific members to include in report Sales
<CHILDREN "Total Market"
<CHILDREN "Calendar Periods"
<CHILDREN "Total Vehicles"
// Always end your script with a !
!
Now, if you execute this simple script, you will get a report file that when opened
looks like this:
United States Sales Model Year
2009 2010
======== ========
2 Door Sedan 20,400 40,800
4 Door Sedan 20,400 40,800
Trang 3Canada Sales Model Year
2009 2010
======== ========
2 Door Sedan 20,400 40,800
4 Door Sedan 20,400 40,800
4X2 Pickup 20,400 40,800
4X4 Pickup 20,400 40,800
Mexico Sales Model Year
2009 2010
======== ========
2 Door Sedan 20,400 40,800
4 Door Sedan 20,400 40,800
4X2 Pickup 20,400 40,800
4X4 Pickup 20,400 40,800
Not too shabby for an amateur, eh? Notice that the output actually looks fairly
presentable and professional and we haven't even taken advantage of any of the real report script functionality Now look at what happens to the output when we add a few commands to the same report script that turns it from a report file into a flat file First, you will notice this line added to the top of the report script file:
//ESS_LOCALE English_UnitedStates.Latin1@Binary
It is just a comment line added by Essbase to identify what language setting is being used by the system so you do not attempt to run with the wrong setting You can
delete the line, but Essbase will put it back again the next time you open and save
the report script through the Essbase report script editor
Trang 4//ESS_LOCALE English_UnitedStates.Latin1@Binary
//This block of commands will turn a report script that create a
//report into a report script that creates an ASCII text flat file //If you look closely you should be able to recognize what some of
//the commands will do For instance, the first one will suppress
//the page heading if any The second command will suppress any
//column headings The third command will suppress any page feeds that //would have been sent to the printer had this been a multiple
//page report
{SUPPAGEHEADING
SUPHEADING
SUPFEED
SUPCOMMA
SUPBRACKETS
NOINDENTGEN
SUPMISSINGROWS
ROWREPEAT}
//This line tells Essbase how to set up the output data For example, //the first command tells Essbase to Tab delimit the output data
//columns.
<SETUP {TabDelimit} {decimal v} {IndentGen -5} <ACCON <SYM <END
//Define page members
<PAGE ("Total Market","METRIC")
//Define column members
<COLUMN ("Calendar Periods")
//Define row members
<ROW ("Total Vehicles")
//Select specific members to include in report
Sales
<CHILDREN "Total Market"
<CHILDREN "Calendar Periods"
<CHILDREN "Total Vehicles"
//Always end your script with a !
!
We have not altered the original script in any way except to add the commands we
explained at the top of the script When we execute the same script now, we get
vastly different output results that are more suitable for a data extract than a report
Trang 52 Door Sedan 20400 40800
4 Door Sedan 20400 40800
4X2 Pickup 20400 40800
4X4 Pickup 20400 40800
2 Door Sedan 20400 40800
4 Door Sedan 20400 40800
4X2 Pickup 20400 40800
4X4 Pickup 20400 40800
2 Door Sedan 20400 40800
4 Door Sedan 20400 40800
4X2 Pickup 20400 40800
4X4 Pickup 20400 40800
With a little rearranging of the row and column commands, we could easily add
the Model Year, Market, and Sales member names to the rows of data, so each
row in the output file would contain all of the necessary data attributes
Yes, there is a lot to learn when it comes to Essbase but it doesn't need to frighten
you Like we said about the calculation scripts in the previous chapter, take baby
steps, and practice
Executing your report scripts
Now that you have created your own report script, pat yourself on the back
and tell yourself that you are going to be a good and successful Essbase
administrator/developer You have overcome the difficult part which is creating
the report script Now comes the easy part, running the report script
Just like executing an Essbase database calculation script, Essbase offers several
methods for executing a database report script
Some of the ways that you can run Essbase database report scripts are: