# EssOtlGetGenName

Description

EssOtlGetGenName() retrieves the name for a specific generation within a dimension.

Syntax

    ESS_FUNC_M EssOtlGetGenName (hOutline, pszDimension, usGen, ppszName);

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

Parameters

hOutline | Outline context handle.
pszDimension | Name of dimension that contains the generation.
usGen | Number of generation for which to get a name. The dimension is generation 1.
ppszName | Buffer for return of generation name, 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

- The generation name follows the same rules as a member name and must be unique across the entire member name space. It cannot duplicate any other generation, level, member name, or alias. Attempting to add a duplicate name generates an error.
- Generation names are not automatically assigned. For this function to return the name, a name must have been assigned. The name can be assigned with EssOtlSetGenName()
- Call EssFree() to free the returned buffer.

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       GenNum;
    ESS_STR_T          GenName;

    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 Gen Name ***************/
    Dimension = "Year";
    GenNum = 3;

    if (!sts)
    {
       sts = EssOtlGetGenName(hOutline, Dimension,
             GenNum, &GenName);
    }

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

See Also

EssFree()
EssOtlDeleteGenName()
EssOtlSetGenName()