Starts sending a calc script and optionally executes it against the active database.
Syntax
ESS_FUNC_M EssBeginCalc (hCtx, Calculate);
Parameter | Data Type | Description |
---|---|---|
hCtx | ESS_HCTX_T | API context handle. |
Calculate | ESS_BOOL_T | Controls calculation of the calc script. If TRUE, the calc script is executed. |
Notes
This call must be followed by successive calls to EssSendString() to send the calc script, and finally by a call to EssEndCalc().
The Calc Script must be less than 64 KB long in total.
The calculation can either be initiated, or the calc script can just be verified and any errors returned.
If the calc script is successfully sent and the calculation is started, it will continue on the server as an asynchronous process after the return from this call. After calling EssEndCalc(), the caller must check at regular intervals to see if the process has completed by calling EssGetProcessState() until it returns ESS_STATE_DONE.
If the Calculate flag is set to FALSE, the database merely performs a syntax check of the calc script.
Unicode clients using the C Main API to communicate with Unicode-enabled Essbase applications must send the UTF-8 encoded Unicode byte order mark (BOM) in the text stream immediately after calling this function. For an example, see Specifying the Byte Order Encoding.
Return Value
None.
Access
This function requires the caller to have calc privilege (ESS_PRIV_CALC) to the active database.
Example
ESS_FUNC_M ESS_Calc (ESS_HCTX_T hCtx) { ESS_FUNC_M sts = ESS_STS_NOERR; ESS_STR_T Script; ESS_PROCSTATE_T pState; Script = "CALC ALL;"; sts = EssBeginCalc (hCtx,ESS_TRUE); if (!sts) sts = EssSendString (hCtx, Script); if (!sts) sts = EssEndCalc (hCtx); if (!sts) { sts = EssGetProcessState (hCtx, &pState); while(!sts && (pState.State != ESS_STATE_DONE)) sts = EssGetProcessState (hCtx, &pState); } return(sts); }
See Also