Calculating your Essbase Cube [ 160 ] Calculation Scripts Mentioned already, but only briey, was the venerable Essbase database calculation script. The database calculation script is an ASCII text le containing a series of precise commands and functions which are used by Essbase to perform calculations on the data stored in an Essbase database. Essbase database calculation scripts are highly versatile and can be written, stored, and executed in a variety of ways. To write an Essbase database calculation script, known as a calc script or calc, the easiest method is to use the Calculation Script Editor provided in EAS. This custom editor provides many features for coding database outline member selections, syntax checking, and function or command choices and their use. The storing of an Essbase database calculation script is something that is entirely upto you—as the programmer/administrator. When you use the EAS Calculation script editor, it will default to saving the calculation script le object in the default Essbase database le structure, which is basically the database folder on the server. This is an acceptable place to leave the scripts, but it is not the best idea to allow access to a secure folder on a database server to too many people. This material is copyright and is licensed for the sole use by Paul Corcorran on 5th July 2009 8601 ave. p #1, , lubbock, , 79423 Download at Boykma.Com Chapter 5 [ 161 ] Again, executing an Essbase database calculation script can easily be performed from just about anywhere. You can execute a calculation script manually through the EAS tool, or through the Essbase Add-in for Microsoft Excel (provided your ID has calculation access), or programmatically using a shelled MaxL script or an API call. The benets of using a painstakingly written Essbase database calculation script are that you can specify the exact subset of data you wish to calculate. Believe it or not, as amazing as an Essbase database calculation script is, there are a couple of drawbacks too. One drawback is that sometimes, because of all the power, an Essbase calculation script can be difcult to control. What we mean is that we can sometimes write a calc that will calculate too much data or take too long to execute. Also, when you create data using an Essbase database calculation script, the newly created data is created as stored data which can be a problem if you are creating too much of it. These are minor concerns which will be handled as you acquire more experience. Stored data member formula The outline member formula on a stored member is one way to create the data values you need in an Essbase database. It is very simple and easy to write, what can be thought of as a snippet of a full blown calculation script in the member formula editor located on the Member Properties screen. Outline member formulas on stored members are also easy to execute as they may execute anytime when the dimension in which they reside is calculated. Dynamic Calc and Dynamic Calc and Store Dynamic Calc and Dynamic Calc and Store are database outline member property settings. Like we told you in the previous section, data created by an Essbase database calculation script is stored in the database. When you set the storage properties on a database member in the Accounts dimension to Dynamic Calc or Dynamic Calc and Store, the member formula will only execute when there is a request for the data. In the case of a dynamically calculated member, the resultant data is not stored in the database, but is recreated every time there is another request for the data. With a dynamic calc and store member, the data is created the rst time there is a request, then stored. On subsequent requests, the data will only be recreated if one of the component values has changed or has been updated. This material is copyright and is licensed for the sole use by Paul Corcorran on 5th July 2009 8601 ave. p #1, , lubbock, , 79423 Download at Boykma.Com Calculating your Essbase Cube [ 162 ] These two data calculation options give you the benet of always producing the freshest data based on the component values. They also help keep the database size small by not storing data or only small amounts of data. What we mean here is that with the use of dynamic calc and dynamic calc and store members you can help keep the size of your database smaller because you are not storing all of the possible data values for these members. A dynamic calc member stores no data in the database and a dynamic calc and store member only stores the data as it has been calculated. Stored members will store all data every time as it has been loaded or calculated, regardless of if anyone ever actually requests it from the database or not. There are several ways to request data from an Essbase database which will trigger a dynamic calc member to create data. One is by performing a Retrieve of data using the Essbase Add-in for Microsoft Excel, another way is executing an Essbase report script. Yes indeed, dynamically calculated data is a nice thing to have, but you must also be careful with its use. While dynamically calculated data offers greater accuracy, it can also be a performance hog depending on the amount of data being requested and the status of the component data involved in the calculation. A good rule of thumb for dynamically calculated data is to make sure you never calculate data whose component values are also dynamically calculated. This situation can cause drastic performance issues by hogging large amounts of memory to perform all of the necessary calculations. Essbase calculation terminology Yes, we're at it again! In the previous chapter, you learned a new term that was related to data intended for loading into an Essbase database. That term was Essbase-friendly. In this chapter, there are more terms you need to learn so you can sound like an Essbase professional and also impress your co-workers. The new terms you will learn in this chapter are Essbase calculation-related terms. In the following sections, we explain the Essbase calculation script commands so it will be helpful for you to become familiar with the calculation jargon rst. This material is copyright and is licensed for the sole use by Paul Corcorran on 5th July 2009 8601 ave. p #1, , lubbock, , 79423 Download at Boykma.Com Chapter 5 [ 163 ] • Calc: You will use this word quite often. This is a very versatile word since you will use it as a noun as well as verb. Calc is Essbase lingo for any database calculation, but it can also describe a calculation action. For example, you could say, "I have written a new calc for gross stock." However, you could also say, "I need to calc the database." Both usages are correct. • Push down: This term is used to describe what happens when you use a calculation function to populate the values of children members with the values of their parents. The time for doing this would be when your data is only loaded at the parent level but the same values should be applied to the children members. • Rollup: This term is used to describe what happens when you add or sum the children members upto their parent level or it can mean the parent level of a group of children. As with calc, this term can be used as a noun or a verb. For example, "I'm writing a calc to rollup the regions to the Total Region level." You could also say, "Total Region is the rollup of the individual regions." • Stomp-on: This is a good one and is mainly used to describe any data that you have unintentionally whacked or overwritten with a calc script. There are times when a parent member's value is not necessarily the rollup of its children. If you execute a calc that inadvertently rolls up the children to the parent, you have just stomped on the parent's data. Because Essbase is an art and not a science and because this is a family book, there are several other terms you can frequently hear around an Essbase installation. We prefer that you learn these terms on your own. Default database calculation script While an Essbase database calculation script can be an extremely powerful tool, it can also be used for more routine database calculating. Whether you need complex calculations or outline rollups, a nice feature in your Essbase database toolbox is the ability to assign a default calculation script to each database. A Default Calc is a database calculation script you would typically nd yourself running repeatedly. To simplify your life, you set the script as the database's Default Calc. As you can imagine, you can set the Default Calc to any database calculation script you have created. By default, Essbase assigns the Calc All database function as the Default Calc. The Calc All function, in simple terms, calculates your database according to the outline member formulas and the consolidations you have specied in your parent-child relationships. This material is copyright and is licensed for the sole use by Paul Corcorran on 5th July 2009 8601 ave. p #1, , lubbock, , 79423 Download at Boykma.Com Calculating your Essbase Cube [ 164 ] To set a calculation script to be your database's Default Calc, start by right-clicking on your database name in EAS and selecting the Set | Default calculation…. You should now see the screen depicted below. As you can see, this screen provides you with several choices regarding how to setting your database's default calculation script. The rst choice you have is a radio button which, when selected, allows you to choose any of the database calculation scripts you have written and stored with the database within the Essbase le structure on your server. Calculation scripts stored elsewhere cannot be chosen as the default calc. If you select the second choice, Use calculation string, you can actually enter your own small set of calculation commands in the text box provided. This is where you will see the Calc All function set by Essbase as the database's Default Calc until you decide to change it. This material is copyright and is licensed for the sole use by Paul Corcorran on 5th July 2009 8601 ave. p #1, , lubbock, , 79423 Download at Boykma.Com . series of precise commands and functions which are used by Essbase to perform calculations on the data stored in an Essbase database. Essbase database calculation scripts are highly versatile. the sole use by Paul Corcorran on 5th July 20 09 8601 ave. p #1, , lubbock, , 794 23 Download at Boykma.Com Chapter 5 [ 161 ] Again, executing an Essbase database calculation script can easily. licensed for the sole use by Paul Corcorran on 5th July 20 09 8601 ave. p #1, , lubbock, , 794 23 Download at Boykma.Com Calculating your Essbase Cube [ 162 ] These two data calculation options give