Discovers if a member name is duplicate.
Syntax
ESS_FUNC_M EssOtlIsMemberNameNonUnique (hOutline, hMember, fNameNonUnique);
Parameter | Data Type | Description |
---|---|---|
hOutline | ESS_HOUTLINE_T | Outline context handle (input). |
hMember | ESS_HMEMBER_T | The member to query for non-uniqueness (input). |
*fNameNonUnique | ESS_BOOL_T | TRUE if the member queried is a duplicate member name (output). |
Notes
Before you call this function, call EssOtlOpenOutline to open the outline in editing mode.
Use aMember Traversal Function to get a member handle for the second argument of this function.
This function checks whether a member name is duplicated. If a member name is duplicated, you might be interested in getting the fully qualified name of a member (its unique name or its key), because if a non specific name is used by other functions in your program to refer to a member name that is duplicated, unexpected behavior could occur.
However, if all names are unique, you do not need to spend the resources to use fully qualified names or keys.
After you use this function, if you discover that a member name is duplicated, you can get the fully qualified name and save it somewhere using EssOtlGetMemberUniqueName.
Return Value
Returns 0 if successful; otherwise, returns an error.
Example
ESS_FUNC_M ESS_ISUniqMemberName() { 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_HMEMBER_T hMemberParent, hMemberChild; ESS_BOOL_T pbNameUnique; 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_FALSE, ESS_TRUE, &hOutline); if (!sts) { sts = EssOtlFindMember(hOutline, "2004", &hMemberParent); } if (!sts && hMemberParent) { sts = EssOtlGetChild(hOutline, hMemberParent, &hMemberChild); } if (!sts) { //Check whether Qtr1 is unique member name, returns 0 if unique and 1 if non-unique sts = EssOtlIsMemberNameNonUnique (hOutline, hMemberChild, &pbNameUnique); if (sts) printf("EssOtlIsMemberNameNonUnique failed sts %ld\n",sts); } return sts; }
See Also