# EssOtlGetLevelName

Description

EssOtlGetLevelName() gets the name for a specific level within a dimension.

Syntax

    ESS_FUNC_M EssOtlGetLevelName (hOutline, pszDimension, usLevel, pszName);

ESS_HOUTLINE_T | hOutline
ESS_STR_T | pszDimension
ESS_USHORT_T | usLevel
ESS_PSTR_T | ppszName

Parameters

hOutline | Outline context handle.
pszDimension | Name of dimension that contains the generation.
usLevel | Number of level number for which to get a name. Leaf members are level 0.
pszName | Buffer for return of the level of the specified dimension, allocated by the API.

Return Value

Returns 0 if successful; otherwise one of the following:

OTLAPI_NO_GENLEVELNAME
OTLAPI_ERR_NOTADIM
OTLAPI_ ERR_GENLEVELNAMEMBR

Notes

- In C programs, call EssFree() to free the returned buffer.
- Level names are not automatically assigned. For this function to return the name, a name must have been assigned. The name can be assigned with EssOtlSetLevelName()

Example

    #include <essapi.h>
    #include <essotl.h>

    ESS_STS_T          sts = 0;
    ESS_HOUTLINE_T     hOutline;
    ESS_OBJDEF_T       Object;
    ESS_APPNAME_T      szAppName;
    ESS_DBNAME_T       szDbName;
    ESS_OBJNAME_T      szFileName;
    ESS_STR_T          Dimension;
    ESS_USHORT_T       LevelNum;
    ESS_STR_T          LevelName;

    memset(&Object, '\0', sizeof(Object));
    Object.hCtx = hCtx;
    Object.ObjType = ESS_OBJTYPE_OUTLINE;
    strcpy(szAppName, "Sample");
    strcpy(szDbName, "Basic");
    strcpy(szFileName, "Basic");
    Object.AppName = szAppName;
    Object.DbName = szDbName;
    Object.FileName = szFileName;

    sts = EssOtlOpenOutline(hCtx, &Object, ESS_TRUE,
          ESS_TRUE, &hOutline);

    /***************  Get Level Name **************/
    Dimension = "Year";
    LevelNum = 0;

    if (!sts)
    {
       sts = EssOtlGetLevelName(hOutline, Dimension,
             LevelNum, &LevelName);
    }

    if (!sts && LevelName)
    {
       printf("Level Name: %s\n",LevelName);
             EssFree(hInst, LevelName);
    }

See Also

EssOtlSetLevelName
EssOtlDeleteLevelName()
EssOtlSetGenName