# EssBeginCalc

Description

EssBeginCalc() starts sending a calc script and optionally executes it against the active database.

Syntax

    ESS_FUNC_M EssBeginCalc (hCtx, Calculate);

ESS_HCTX_T | hCtx
ESS_BOOL_T | Calculate

Parameters

hCtx | Essbase API context handle.
Calculate | Controls calculation of the calc script. If TRUE, the calc script is executed.
CalcScript | The calc script, as a single string (must be less than 64 Kbytes).

Return Value

None.

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 Kbytes 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.

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

EssCalc()
EssCalcFile()
EssDefaultCalc()
EssEndCalc()
EssGetDefaultCalc()
EssGetProcessState()
EssSendString()
EssSetDefaultCalc()