Calculating your Essbase Cube [ 200 ] Writing and saving a Calculation Script For starters, we will begin by entering the example code we used earlier to demonstrate the FIX and ENDFIX command. We will then save the le (Essbase calculation script object). As you can see above, we have entered a basic FIX statement wrapped around a simple GROSS STOCK calculation where GROSS STOCK = PRODUCTION – SALES. The way this calculation script is written, Essbase will calculate a value for GROSS STOCK at descendents of the Calendar Periods level (all child members of the Calendar Periods member). This is an actual executable database calculation script which will really calculate a value for the GROSS STOCK member. It is also an excellent calculation script that is perfect for illustrative purposes. Members not selected by the FIX command are not included in the calculation. Although very brief and simple, it is a valid and executable Essbase database calculation script. We can now save this script to the server. To save your database calculation script, do the following: 1. Make sure you are in EAS, then, simply click on File | Save. 2. A standard le save dialog box will open. 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 [ 201 ] 3. You are given the option of selecting a le system to save your script to or letting Essbase save the le in its own le system. EAS defaults to the Essbase le system and for this and future examples, please allow Essbase to choose the location of the le. For most Essbase functionality including EssCmd, MaxL, and so on, the Essbase command or function will look in the default location, which is the Application or Database folder located on your analytic server for the named calculation script. In most cases, all you need to provide is the name of the calculation script instead of the complete location (path) of the object. 4. Give your calculation script a name, but remember, no more than eight characters! 5. Click Save and your Essbase database calculation script is now saved to the Essbase analytic server. Congratulations! Now, get ready as we take this script and use it as an example of the many different ways you can execute an Essbase database calculation script. Executing your Calculation Scripts After all that work, you do you would want to actually run your database calculation script, don't you? Ha, of course you do! Because the database calculation is such an important part of the entire Essbase experience, Essbase provides you with many different methods for executing a database calculation script. As you will learn, there are coding options that give you great exibility when you are automating the database calculation process. There is also generous exibility given too which allows users to execute database calculation scripts without the time and expense of coding some elaborate process. The best part is that you, the Essbase database administrator/programmer, can make the determination as to the best method to employ for you particular situation. Running Calculation Scripts manually using EAS EAS should be your best friend by now. This tool is your one-stop source of Essbase administration tools. This is why it should be no surprise that after you have coded your new Essbase database calculation script using the EAS tool, you can also execute the script using the EAS tool. This ability facilitates effortless testing of database calculation scripts or easy running of maintenance calculation scripts. 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 [ 202 ] There are several ways to execute a database calculation script from EAS. For starters, if you have a script to run that you already know is ready to go without changes, all you need to do is drill-down to the calculation script name and right-click on it then select Execute…. A small dialog box will open which will contain the name of the script you have selected with buttons to Cancel, get Help, or click OK to execute. This dialog box will also offer you the choice to select Execute in the background. If you select the Execute in the background option, Essbase will run the calculation script in the background, thus freeing up the EAS tool and allowing you to work on something else while the calculation script is running. If you do not select the Execute in the background option, the EAS tool it will continue to display the small Execute Calculation Script screen while the calculation script is running and you will not be able to perform any tasks in this session of EAS until the calculation script completes. 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 [ 203 ] The other method of executing a database calculation script through the EAS tool is when you have the script itself opened in the Calculation Script Editor (shown above). By opening the database calculation script in the editor you activate three more ways to execute an Essbase database calculation script: 1. Click on the menu pick, Options | Execute Script. 2. Click on the button on the EAS toolbar that has the small downward pointing arrow. 3. Press the F5 function key on your keyboard. All three of these options perform the exact same task of executing the active database calculation script currently opened in the Calculation Script Editor of your EAS tool. Something you must consider is when a calculation script is running against a database, it is a good idea to refrain from attempting to perform database maintenance or update tasks to the database itself. For example, if you make changes to the outline and attempt to save the outline while a calc script is running, the outline save will fail due to portions of the database being locked by the calculation process. Running a Calculation Script using an Essbase Command Script (EssCmd) As discussed in previous chapters, Essbase offers you several coding options that you can use to automate many Essbase tasks and functions. The Essbase Command Script, or EssCmd, is one of these options. The EssCmd is an ASCII text le that contains Essbase-specic commands. The EssCmd database command script, like all Essbase objects, must be named using no more than eight characters. The extension used is .scr. The EAS tool does not provide an ofcial editor for writing EssCmd scripts so in Windows for example, you would use any text editor such as Notepad. 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 [ 204 ] We discuss in-depth task automation for your Essbase system in future chapters. Here, we will show what a basic EssCmd script should look like to execute your Gross Stock database calculation script. What the EssCmd script looks like The basic coding of an Essbase Command Script (EssCmd) is shown below. We would enter the code for the EssCmd as shown and then save it as GrsStk.scr on the Essbase analytic server in the Application or Database folder: OUTPUT 1 "c:\Esscmd.log"; LOGIN "EssServerID" "EssID" "EssPass" "ESSCAR" "ESSCAR"; RUNCALC 2 GRSSTK; OUTPUT 3; LOGOUT; EXIT; We will cover in-depth Essbase command scripts and how to write and use them in a future chapter. In the meantime, for more information, refer to the online technical reference included with your EAS software. • The rst command statement you see is the OUTPUT statement. This statement, followed by the number 1 and a path and lename, tells Essbase to begin logging the execution of this script and where to put the log. • Next, the LOGIN statement, followed by a space separated list, will remotely connect to the Essbase server. The list includes the server name or IP Address, the Essbase ID, the password for the Essbase ID, the application name you want to connect to, and the Essbase database name. • Here is the command we are now using! The RUNCALC command statement is followed by a number and the calculation script name. In this case, the number 2 tells Essbase that the calculation script is an analytic server stored Essbase object. The calc type is followed by the calculation script name. • Next up is the OUTPUT statement again. This time, we have coded a 3 after the command which tells Essbase to turn off the logging output. • Finally, we code the LOGOUT and EXIT commands. The LOGOUT statement disconnects the script from Essbase and the EXIT command exits the script from the Essbase session. 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 . the Essbase le system and for this and future examples, please allow Essbase to choose the location of the le. For most Essbase functionality including EssCmd, MaxL, and so on, the Essbase. using an Essbase Command Script (EssCmd) As discussed in previous chapters, Essbase offers you several coding options that you can use to automate many Essbase tasks and functions. The Essbase. Corcorran on 5th July 20 09 8601 ave. p #1, , lubbock, , 794 23 Download at Boykma.Com Calculating your Essbase Cube [ 204 ] We discuss in-depth task automation for your Essbase system in future