# EssGetProcessState

Description

EssGetProcessState() gets the current state of an asynchronous process, such as a calculate or a data import.

Syntax

    ESS_FUNC_M EssGetProcessState (hCtx, pProcState);

ESS_HCTX_T | hCtx
ESS_PPROCSTATE_T | pProcState

Parameters

hCtx | Essbase API context handle.
pProcState | Pointer to process state structure

Return Value

If successful, returns the current process state 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

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().

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

EssBeginCalc()
EssCalc()
EssCancelProcess()
EssImport()