Databases Reference
In-Depth Information
Running a Calculation Script using the
Essbase API
The Essbase API is a comprehensive set of tools that allow you, the Essbase
programmer/database administrator, to automate many Essbase tasks and
functions through code in several popular languages.
For the sake of consistency, our examples in this topic will mainly focus on the use
of Microsoft Visual Basic, or COM+, in a Microsoft Windows environment. The
following is an example of the code required to execute the GRSSTK.csc database
calculation script using a call to the Essbase API from Microsoft Visual Basic.
In your program, your typical Essbase calculation call would be in a sub-routine
like the following:
Declare Function EsbCalc Lib "ESBAPIN" (ByVal hCtx As Long, ByVal
Calculate As Integer, ByVal Script As String) As Long
Sub ESB_Calc ()
Dim sts As Long 'Essbase process return code
Dim Script As String 'Variable to hold calc script
Dim Calculate As Integer '1 = Yes, 0 = No
Dim ProcState As ESB_PROCSTATE_T ' Test if calc still running
Script = "CALC ALL;" 'Calculation script passed as a string up to
'64 KB in length
Calculate = ESB_YES 'Set API calc function to Yes meaning to
'Execute the calc script
sts = EsbCalc (hCtx, Calculate, Script) 'Actual call to the
'calculation function
sts = EsbGetProcessState (hCtx, ProcState) 'Test the process
'state
Do Until ProcState.State = ESB_STATE_DONE
sts = EsbGetProcessState (hCtx, ProcState)
Loop 'Perform this loop until the calc script has completed
End Sub
What you see here is a basic VB sub-routine. We will explain it using the Essbase API
in greater detail later in this topic, but to demonstrate the many ways to execute a
database calculation script it is necessary to go over this briefly:
 
Search WWH ::




Custom Search