Gets the current state of an asynchronous process, such as a calculate or a data import.
Syntax
ESS_FUNC_M EssGetProcessState (hCtx, pProcState);
Parameter | Data Type | Description |
---|---|---|
hCtx | ESS_HCTX_T | API context handle. |
pProcState | ESS_PROCSTATE_T | Pointer to process state structure |
Notes
Your program should call this function at regular intervals (between 5 & 10 seconds) until it returns ESS_STATE_DONE in pProcState.
Calling this function except after initiating a successful asynchronous database operation, for example, a calculation, generates an error.
The memory allocated for pProcState should be freed using EssFree().
Return Value
If this function is unable to get the process state, an error is returned. If the process terminates because of an error, then its error code is returned. Otherwise, this function returns ESS_STS_NOERR, and the current process state is given in the state structure pProcState. Values for pProcState:
ESS_STATE_DONE—0 = Done
ESS_STATE_INPROGRESS—1 = In progress
ESS_STATE_FINALSTAGE—5 = In final stage; cannot be canceled
Access
This function requires no special privilege.
Example
ESS_FUNC_M ESS_RunCalc (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