# EssGetMemberCalc

Description

EssGetMemberCalc() gets the calc equation for a specific member in the active database outline.

Syntax

    ESS_FUNC_M EssGetMemberCalc (hCtx, MbrName, pCalcStr, pLastCalcStr);

ESS_HCTX_T | hCtx
ESS_STR_T | MbrName
ESS_PSTR_T | pCalcStr
ESS_PSTR_T | pLastCalcStr

Parameters

hCtx | Essbase API context handle.
MbrName | Member name.
pCalcStr | Address of pointer to receive allocated member calc string.
pLastCalcStr | Address of pointer to receive allocated member last calc string.

Return Value

If successful, this function returns the calc string and last calc string in pCalcStr and pLastCalcStr.

Notes

- The last calc string is the formula used to calculate the member the last time the database was calculated. It might be left from pCalStr if a calc script was used to calculate the database.
- This function checks whether the relational span Boolean is set and can determine if members stored in attached relational data sets have calc strings, but returns a NULL string instead of the calc string.
- The memory allocated for pCalcStr and pLastCalcStr should be freed using EssFree().

Access

This function requires the caller to have at least read access (ESS_PRIV_READ) to the database, and to have selected it as their active database using EssSetActive().

Example

    ESS_FUNC_M
    ESS_GetMbrCalc (ESS_HCTX_T  hCtx,
                    ESS_HINST_T hInst
                   )
    {
       ESS_FUNC_M     sts = ESS_STS_NOERR;
       ESS_STR_T     calcStr, lastCalcStr;

       calcStr = lastCalcStr = NULL;
    sts = EssGetMemberCalc(hCtx, "Year", &calcStr, &lastCalcStr);
       if (!sts)
       {
          if (calcStr)
          {
             printf ("Outline Defined Calc Equation -- [%s]\r\n", calcStr);
          }
    else
          {
             printf ("Outline Defined Calc Equation -- [Default Rollup]\r\n");
          }

          if (lastCalcStr)
          {
             printf ("Last Calculated Calc Equation -- [%s]\r\n", lastCalcStr);
          }
          else
          {
             if (calcStr)
                printf ("Last Calculated Calc Equation -- [%s]\r\n", calcStr);
             else
                printf ("Last Calculated Calc Equation -- [Default Rollup]\r\n");
          }

       }
       if (calcStr)
          EssFree (hInst, calcStr);
       if (lastCalcStr)
          EssFree (hInst, lastCalcStr);

      return (sts);
    }

See Also

EssGetMemberInfo()
EssSetActive()