Sets whether members in a certain dimension at a certain level are prohibited from having duplicate names.
Syntax
ESS_FUNC_M EssOtlSetLevelNameEx (hOutline, pszDimension, usLevel, pszName, bUniqueName);
Parameter | Data Type | Description |
---|---|---|
hOutline | ESS_HOUTLINE_T | Outline context handle. |
pszDimension | ESS_STR_T | Name of dimension that contains the level. |
usLevel | ESS_USHORT_T | Number of level for which to set a name. Leaf members are level 0. |
pszName | ESS_STR_T | Name to give the level. |
bUniqueName | ESS_BOOL_T | If TRUE, members at level uslevel in dimension pszDimension cannot have duplicate names. If FALSE, duplicate names are allowed. |
Notes
The level name 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 level name generates an error.
This function sets the name of a level as well as the uniqueness property of a level. If you only want to set the name, use EssOtlSetLevelName.
If you only want to set the uniqueness property, but not change the name, you must still pass in the name. To do so, call EssOtlGetLevelName and pass its value to this function as usLevel.
Do not pass null for the usLevel parameter.
Return Value
Returns 0 if successful; otherwise, returns an error code.
Example
ESS_FUNC_M
ESS_GetLevelNameEx()
{
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;
ESS_BOOL_T bUnique= ESS_FALSE;
memset(&Object, '\0', sizeof(Object));
Object.hCtx = hCtx;
Object.ObjType = ESS_OBJTYPE_OUTLINE;
strcpy(szAppName, "Demo");
strcpy(szDbName, "Test");
strcpy(szFileName, "Test");
Object.AppName = szAppName;
Object.DbName = szDbName;
Object.FileName = szFileName;
sts = EssOtlOpenOutline(hCtx, &Object, ESS_TRUE,
ESS_TRUE, &hOutline);
/*************** Set and Get Level Name **************/
Dimension = "Year";
LevelNum = 0;
LevelName = "Level 0 Year";
//SetLevelNameEx() so that level 0 member of Year cannot be non-unique
if (!sts)
{
sts = EssOtlSetLevelNameEx(hOutline, Dimension,
LevelNum, LevelName, ESS_TRUE);
}
// GetLevelNameEx() to see if the level is able to be non-unique
if (!sts)
{
sts = EssOtlGetLevelNameEx(hOutline, Dimension,
LevelNum, &LevelName, &bUnique);
printf("Level 0 members of Year have bUnique value of %ld\n", bUnique);
}
if (!sts && LevelName)
{
printf("Level Name: %s\n",LevelName);
EssFree(hInst, LevelName);
}
return (sts);
}
See Also