EssOtlGetMemberUniqueName

Returns the member name (if the member name is unique) or the minimum qualified name required to distinguish the member (if the member name is duplicate).

Syntax

ESS_FUNC_M EssOtlGetMemberUniqueName (hOutline, hMember, *szFullName);
ParameterData TypeDescription

hOutline

ESS_HOUTLINE_T

Outline context handle (input).

hMember

ESS_HMEMBER_T

Member handle (input).

*szFullName

ESS_STR_T

The returned member name or qualified member name (output).

Notes

Return Value

Returns 0 if successful; otherwise, returns an error.

Example

Example 1

The output of this function in the following example is the fully qualified member name of Qtr1: [2004].[Qtr1]

ESS_FUNC_M ESS_GetMemberUniq()
{
 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    szFullName;
 ESS_HMEMBER_T   hMemberParent;
 ESS_HMEMBER_T   hMemberChild;
 

 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);
 
 if (!sts)
 {
  sts = EssOtlFindMember(hOutline, "2004", &hMemberParent);
 }
 
 if (!sts && hMemberParent)
 {
  sts = EssOtlGetChild(hOutline, hMemberParent, &hMemberChild);
 }
 
 
 /*Get the qualified name of the first child of 2004, Qtr1*/
 if (!sts)
 {
  sts = EssOtlGetMemberUniqueName (hOutline, hMemberChild, &szFullName);
 
  if (sts)
   printf("EssOtlGetMemberUniqueName failed sts %ld\n",sts);
  else
   printf("Qtr1's qualified name is: %s\n", szFullName);
 }
 

 return sts;
}

Example 2

The following example shows this function used in query mode.

   member_fields     = "<SelectMbrInfo (membername,  uniquename) "; 
   member_selection  = "@SHARE(@DESCENDANTS(product))"; 
   MaxCount          = -1; 
   phMemberArray     = ESS_NULL; 
   pqryErrorList     = ESS_NULL; 

   status = EssOtlQueryMembersEx(hOutline, 
                          member_fields, 
                          member_selection, 
                          &MaxCount, 
                          &phMemberArray, 
                          &pqryErrorList); 

   if (status) goto exit; 

   for (int i = 0; i < MaxCount; i++) 
   { 
     status = EssOtlGetMemberField(hOutline, phMemberArray[i], ESS_OTLQRYMBR_NAME, 
       (ESS_PPVOID_T) &pName); 
     if (status) goto exit; 

     status = EssOtlGetMemberUniqueName(hOutline, phMemberArray[i], &pUniqueName2); 
     if (status) goto exit; 
   }