Executes a calc script against the active database from a file.
Syntax
ESS_FUNC_M EssCalcFile (hDestCtx, hSrcCtx, AppName, DbName, FileName, Calculate);
Parameter | Data Type | Description |
---|---|---|
hDestCtx | ESS_HCTX_T | API context handle of target database on the server. |
hSrcCtx | ESS_HCTX_T | 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 | ESS_STR_T | Application name for calc script file location. |
DbName | ESS_STR_T | Database name for calc script file location. |
FileName | ESS_STR_T | Name of calc script file. |
Calculate | ESS_BOOL_T | Controls calculation of the calc script. If TRUE, the calc script is executed and the call is asynchronous. |
Notes
The calc script must not be greater 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.
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_CalcFile (ESS_HCTX_T hCtx) { ESS_FUNC_M sts = ESS_STS_NOERR; ESS_SHORT_T isResponse; ESS_HCTX_T hSrcCtx; ESS_BOOL_T isObject = ESS_FALSE; ESS_STR_T AppName; ESS_STR_T DbName; ESS_STR_T FileName; ESS_PROCSTATE_T pState; hSrcCtx = hCtx; AppName = "Sample"; DbName = "Basic"; FileName = "Test"; sts = EssCalcFile (hCtx, hSrcCtx, AppName, DbName, FileName, ESS_TRUE); if (!sts) { sts = EssGetProcessState (hCtx, &pState); while (!sts && (pState.State != ESS_STATE_DONE)) sts = EssGetProcessState (hCtx, &pState); } return(sts); }
See Also