# EsbCalcFile

Description

EsbCalcFile() executes a calc script against the active database from a file.

Syntax

    EsbCalcFile (hDestCtx, hSrcCtx, AppName, DbName, FileName, isCalculate)

    ByVal hDestCtx    As Long
    ByVal hSrcCtx     As Long
    ByVal AppName     As String
    ByVal DbName      As String
    ByVal FileName    As String
    ByVal isCalculate As Integer

Parameters

hDestCtx | Essbase VB API context handle of target database on the server.
hSrcCtx | Essbase VB API context handle for calc script file location. The calc script file can reside on the client or on the same server as the target database.
AppName | Application name for calc script file location.
DbName | Database name for calc script file location.
FileName | Name of calc script file.
isCalculate | Controls calculation of the calc script. If TRUE, the calc script is executed.

Return Value

None.

Notes

- The calc script must be less than 64 Kbytes long.
- If this function succeeds and the calculation is started, it will continue on the server as an asynchronous process after the return from this call. The caller should check at regular intervals to see if the process has completed by calling EsbGetProcessState() until it returns ESB_STATE_DONE.

Access

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

Example

    Declare Function EsbCalcFile Lib "ESBAPIW" (ByVal hDestCtx As Long, ByVal hSrcCtx As Long, ByVal AppName As String, ByVal DbName As String, ByVal FileName As String, ByVal isCalculate As Integer) As Long

    Sub ESB_CalcFile ()
       Dim sts As Long
       Dim AppName As String
       Dim DbName As String
       Dim FileName As String
       Dim Calculate As Integer
       Dim hSrcCtx As Long
       Dim ProcState As ESB_PROCSTATE_T

       AppName = "Sample"
       DbName = "Basic"

       '***************************************
       ' Calc script is an object at the server *
       '***************************************
       hSrcCtx = hCtx
       FileName = "calc"
       Calculate = ESB_YES '**********
       ' Calc File
       '**********
       sts = EsbCalcFile (hCtx, hSrcCtx, AppName,
       DbName, FileName, Calculate)

       '************************************
       ' 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()
EsbCalc()
EsbDefaultCalc()
EsbSetDefaultCalcFile()
EsbGetProcessState()