# EssGetCalcList

Description

EssGetCalcList() gets the list of calc scripts objects which are accessible to a user.

Syntax

    ESS_FUNC_M EssGetCalcList (hCtx, UserName, AppName, DbName, pAllCalcs, pCount, ppCalcList);

ESS_HCTX_T | hCtx
ESS_STR_T | UserName
ESS_STR_T | AppName
ESS_STR_T | DbName
ESS_PBOOL_T | pAllCalcs
ESS_PUSHORT_T | pCount
ESS_PPOBJNAME_T | ppCalcList

Parameters

hCtx | Essbase API context handle
UserName | User name
AppName | Application name
DbName | Database name
pAllCalcs | Address of a variable to receive the allow all calcs flag. If TRUE, the user can access all calc scripts, otherwise, they can only access those specified in the CalcList argument.
pCount | Address of variable to receive a count of the number of accessible calc script objects
ppCalcList | Address of a pointer to receive an allocated array of calc script object names

Return Value

If successful, the user's allow all calcs setting is returned in pAllCalcs, a count of their accessible calc scripts objects is returned in pCount, and a list of calc script object names is returned in ppCalcList.

Notes

- In order to access any calc script objects, the specified user must have at least calculate access to the appropriate database.
- If the pAllCalcs flag is set to TRUE, pCount is zero, and ppCalcList is NULL.
- The memory allocated for ppCalcList should be freed using EssFree().

Access

This function requires the caller to have database Design privilege (ESS_PRIV_DBDESIGN) for the specified database, unless they are getting their own calc list.

Example

    ESS_FUNC_M
    ESS_GetCalcList (ESS_HCTX_T  hCtx, ESS_HINST_T hInst)
    {
       ESS_FUNC_M       sts = ESS_STS_NOERR;
       ESS_STR_T       UserName;
       ESS_STR_T       AppName;
       ESS_STR_T       DbName;
       ESS_BOOL_T      AllCalcs;
       ESS_USHORT_T    Count, ind;
       ESS_POBJNAME_T  pCalcList = NULL;

       UserName = "Admin";
       AppName  = "Sample";
       DbName   = "Basic";
       sts = EssGetCalcList(hCtx, UserName, AppName,
             DbName, &AllCalcs, &Count, &pCalcList);
       if(!sts && pCalcList)
       {
    printf("-------- Get Calc List -----------\r\n");
          for (ind = 0; ind < Count; ind ++)
             printf(" %s\r\n",pCalcList[ind]);

          EssFree(hInst, pCalcList);
       }

       return (sts);
    }

See Also

EssListObjects()
EssListUsers()
EssSetCalcList()