Sends a single string. This function is equivalent to making a call to EssBeginCalc(), followed by calls to EssSendString(), and finally to EssEndCalc(). The calculation can either be initiated, or the calc script can just be verified and any errors returned.
Syntax
ESS_FUNC_M EssCalc (hCtx, Calculate, CalcScript);
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 and the call is asynchronous. |
CalcScript | ESS_STR_T | The calc script, as a single string (must be less than 64 KB). |
Notes
The calc script string must be less than 64 KB 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 must check at regular intervals to see if the process has completed by calling EssGetProcessState() until it returns ESS_STATE_DONE.
This API call is asynchronous only if the Calculate parameter is TRUE. Otherwise, it is a simple synchronous request.
During an asynchronous request, control is passed back to the program immediately, before the request completes. The set of valid requests for the current API context handle is limited during the time the asynchronous request is running. If you give an invalid request during that time, an error is returned. The list of valid API calls on the API context during an asynchronous operation is: EssGetProcessState, EssCancelProcess.
If the Calculate flag is set to FALSE, the database merely performs a syntax check of the calc script, and the call is synchronous.
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_CalcLine (ESS_HCTX_T hCtx) { ESS_FUNC_M sts = ESS_STS_NOERR; ESS_STR_T Script; ESS_PROCSTATE_T pState; Script = "CALC ALL;"; sts = EssCalc(hCtx, ESS_TRUE, Script); if (!sts) { sts = EssGetProcessState (hCtx, &pState); while (!sts && (pState.State != ESS_STATE_DONE)) sts = EssGetProcessState (hCtx, &pState); } return(sts); }
See Also