Example: CLEARDATA "TOTAL REVENUE"; The functions discussed above are just some of the more widely used calculation script functions available to you.. Conditionals In the Essbase databa
Trang 1The command above enables four threads to run in parallel This means that upto four threads can be used by the system to calculate the data instead of
the default one thread
• SET FRMLBOTTOMUP ON/OFF: This command enables you to do bottom-up
calculation on the formulas The command can help speed up the processing
of complex formulas on Sparse Dimensions when the associations and
dependencies are straight forward When there are a lot of range type
functions used, there may be inconsistent results achieved
SET FRMLBOTTOMUP ON;
SET FRMLBOTTOMUP OFF;
• DATACOPY membername1 to membername2: This command copies data from
one member to another member
DATACOPY "TOTAL REVENUE" to "BILLED REVENUE";
This example above will copy the values in TOTAL REVENUE to BILLED
REVENUE across all levels
DATACOPY "TOTAL REVENUE"->@LEVMBRS("Calendar Periods", 3) to
"BILLED REVENUE"->@LEVMBRS("Calendar Periods", 0);
This example above will copy TOTAL REVENUE from the YEARS level to
BILLED REVENUE at the month level
In a database calculation script, member names which have a space in
them must be in double quotes If there is no space in a member name,
there is no need to have a double quote
It is not a bad idea to always wrap member names in double quotes,
whether they contain spaces or not This makes them easily identifiable
when reading a calc script
• CLEARBLOCK ALL/UPPER/NONINPUT/DYNAMIC/EMPTY: This command clears the blocks and sets "#missing" in the blocks You need to clear blocks before data refreshes to clear off all of the old data Remember, this is not entirely
removing the blocks, these blocks still exist and when you do a data load it
will be a little slower If a block had no data already, meaning it is already
#missing, it will be removed
° ALL: Clears and sets "#missing" to all data blocks
° UPPER: Clears and sets "#missing" to all of the consolidated
level blocks
° NON INPUT: Clears and sets "#missing" to all of the non-input
members, the members to which data is not directly loaded
Trang 2° DYNAMIC: Clears and sets "#missing" to all of the data which has
been created by a Dynamic Calc and Store member
° EMPTY: Removes all of the blocks which are already
"#missing" blocks
Examples:
CLEARBLOCK ALL;
CLEARBLOCK UPPER;
• CLEARDATAMemberName: Removes all of the data for the member name
specified, replacing it with "#missing" The "#missing" symbol is Essbase
speak for null values
Example:
CLEARDATA "TOTAL REVENUE";
The functions discussed above are just some of the more widely used calculation script functions available to you We will discuss more functions in the coming chapters
Conditionals
In the Essbase database calculation script, like most other programming languages, you can test data situations with conditional statements Without a doubt, the IF
and ENDIF statements are the most common
IF/ENDIF
Ah yes, the IF and ENDIF commands, the partners to the FIX and ENDFIX commands
As stated earlier in this chapter, these tools have been provided to allow you to write high performing and efficient calculation scripts and to precisely calculate your data without stomping on other data
If the FIX and ENDFIX commands are the gate keeper of the data, the IF and ENDIF
commands are the ushers directing you (your data) to the correct seat Just like the
IF and ENDIF commands in any programming language, the IF and ENDIF commands you use in Essbase for calculating, perform conditional checking or testing of the data
to help decide if or how it gets calculated
Trang 3Remember the FIX and ENDFIX commands are best used on Sparse
Dimension due to the physical construction of the Essbase cube Well,
the opposite is recommended for the IF and ENDIF commands Because
the IF statement needs to test every occurrence of the data brought to it,
it is best to use the IF and ENDIF commands against a Dense Dimension
because there will be fewer cells of data that need to be tested since the
original subset of data was pulled in as a Sparse Dimension
For example:
FIX(Sparse Dimension)
IF(Dense Dimension)
Any Calculation Function;
ENDIF
ENDFIX
Again, while this is not always possible, it is a good idea to follow this
recommendation whenever possible
Just like the FIX and ENDFIX commands, the IF and ENDIF commands can be nested
We have never been able to determine if there is a limit, but we have also never
hit a limit when coding either For every IF statement, there must be a matching
ENDIF statement When using ELSE or ELSEIF, you will still need one ENDIF for
every IF statement
For example:
IF(Conditional Argument)
Any Calculation Function;
ENDIF
Or this:
IF(Conditional Argument)
IF(Conditional Argument)
Any Calculation Function;
ELSEIF(Conditional Argument)
Any Calculation Function;
ELSE
Any Calculation Function;
ENDIF
ENDIF
Also, like the FIX and ENDFIX commands, the IF and ENDIF command statements
do not need to be terminated with a semi-colon Only the actionable calculation
function statements need to be terminated by a semi-colon
Trang 4Unlike the FIX and ENDFIX commands, the IF and ENDIF commands can be used
in Essbase calculation scripts as well as database outline member formulas
Much like the FIX command, the IF command accepts a comma separated list
of conditional arguments, of which a full compliment is included in Essbase
Always remember with IF and ENDIF, you want to Fix on Sparse and IF on Dense
Boolean
As you know, Boolean tests are used to check for either a true or false condition
In an Essbase calc script, you can make good use of the Boolean test functions
Some of the more widely used Boolean functions are @ISUDA, @ISMBR, @ISLEV,
@ISGEN, @ISPARENT, @ISCHILD, and many more
Some of the most widely used Boolean functions are discussed here:
• @ISMBR: This function is used to test if the current member being calculated
is a member specified by the parameter(s) entered into the function
Syntax:
@ISMBR (membername, rangelist, mbrlist)
° membername—a single member name
° rangelist—a range of members returned by a member function
° mbrlist—a comma separated list of members
Example:
@ISMBR("DETROIT")—returns true if the current member is DETROIT
• @ISLEV: Returns true if the current member being calculated is in the same
level as the member specified in the @ISLEV parameter
Syntax:
@ISLEV(dimname, levelname, level number)
Example:
@ISLEV("TOTAL CUSTOMER",0)—returns true if the current
member is in the zero level in the database outline
• @ISCHILD(mbrname): Returns true if the current member is child of
the member specified in the @ISCHILD parameter
Syntax:
@ISCHILD(mbrname)
Trang 5Example:
@ISCHILD("DETROIT")—returns true for all members that are children of
the DETROIT member
These are just a few of the many Boolean functions that Essbase has provided to
you to allow for the increased performance of customized database calculations
You should now have a good understanding on their use and the parameters
required to make them perform as designed
Relationship functions
As you know, an Essbase cube is lot like a family In fact, this is a family that has
a lot of relationships The relationship functions are used to fetch data for the
current member position from a different member's position The most widely
used relationship functions are @PARENTVAL and @ANCESTVAL
• @PARENTVAL(dimension, membername): This function returns the value
of the parent of the current member being calculated for the listed member
Example:
@PARENTVAL("TOTAL VEHICLE","TOTAL SALES"): This returns the TOTAL
SALES for the parent of the current member
This is the product structure of our Esscar Database:
If the current product member being calculated is "2DOORSEDAN",
then the output of this:
@PARENTVAL ("TOTAL VEHICLE","TOTAL SALES") is TOTAL SALES
for the CARS outline member which is the parent of "2 DOOR SEDAN".
• @ANCESTVAL(dimension, genlevNum, [membername]): This function
returns the value of the parents, grandparents, great grandparents using
either the generation or level reference from the current member selected