EsbCalc

Description

EsbCalc() sends and optionally executes a calc script against the active database as a single string. This function is equivalent to making a call to EsbBeginCalc, followed by calls to EsbSendString(), and finally to EsbEndCalc(). The calculation can either be initiated, or the calc script can just be verified and any errors returned.

Syntax
EsbCalc (hCtx, isCalculate, cscQuery)
ByVal hCtx        As Long
ByVal isCalculate As Integer
ByVal cscQuery    As String

Parameters

hCtxEssbase VB API context handle.
isCalculateControls calculation of the calc script. If TRUE, the calc script is executed.
cscQueryThe calc script, as a single string (must be less than 64 Kbytes).

Return Value

None.

Notes

Access

This function requires the caller to have calc privilege (ESB_PRIV_CALC) to the active database.

Example

Declare Function EsbCalc Lib "ESBAPIW" (ByVal hCtx As Long, ByVal Calculate As Integer, ByVal Script As String) As Long

Sub ESB_Calc ()
   Dim sts As Long
   Dim Script As String 
   Dim Calculate As Integer
   Dim ProcState As ESB_PROCSTATE_T

   Script = "CALC ALL;"
   Calculate = ESB_YES

   '**********
   ' Calculate
   '**********
   sts = EsbCalc (hCtx, Calculate, Script)

   '************************************
   ' Check process state till it is done 
   '************************************
   sts = EsbGetProcessState (hCtx, ProcState)
    Do Until ProcState.State = ESB_STATE_DONE 
      sts = EsbGetProcessState (hCtx, ProcState)
   Loop 
End Sub

See Also

EsbBeginCalc()
EsbCalcFile()
EsbDefaultCalc()
EsbEndCalc()
EsbGetDefaultCalc()
EsbGetProcessState()
EsbSendString()
EsbSetDefaultCalc()