# EssOtlSetDTSMemberAlias

Description

EssOtlSetDTSMemberAlias sets an alias name for a Dynamic Time Series (DTS) member.

Syntax

    ESS_STS_T EssOtlSetDTSMemberAlias (hOutline, pszDTSMember, pszAliasTable, pszAlias);

ESS_HOUTLINE_T | hOutline
ESS_STR_T | pszDTSMember
ESS_STR_T | pzsAliasTable
ESS_STR_T | pszAlias

Parameters

hOutline | The Essbase outline handle returned from the EssOtlOpenOutline() call.
pszDTSMember | Name of the DTS member which provides the alias.
pzsAliasTable | Name of the alias table which provides the alias. If NULL, the default alias table is used.
pszAlias | Pointer to a C string containing the alias name for the DTS member.

Return Value

If successful the return value is zero. Otherwise, one of the following is returned:

OTLAPI_ERR_DTSMBRNOTDEFINED
OTLAPI_BAD_ALIASTABLE
OTLAPI_ERR_ILLEGALALIASSTRING
OTLAPI_ERR_DUPLICATEALIAS

Example

    #include "essapi.h"
    #include "essotl.h"
    #include "esserror.h"

    ESS_STS_T ESS_OtlSetDTSMemberAlias(ESS_HCTX_T hCtx, ESS_HINST_T hInst)
    {
    	ESS_STS_T	sts =ESS_STS_NOERR;
    	ESS_OBJDEF_T	Object;
    	ESS_HOUTLINE_T	hOutline;
    	ESS_APPNAME_T	szAppName;
    	ESS_DBNAME_T	szDbName;
    	ESS_OBJNAME_T	szFileName;
    	ESS_CHAR_T	pszAliasTable[ESS_ALIASNAMELEN];
    	ESS_CHAR_T	pszAlias[ESS_ALIASNAMELEN];
    	ESS_CHAR_T	pszDTSMember[ESS_MBRNAMELEN];
    	ESS_PROCSTATE_T	pState;
    	ESS_ULONG_T	ulErrors;
    	ESS_ULONG_T	ulCount;
    	ESS_POUTERROR_T	pMbrErrors = NULL;

    	strcpy(szAppName, "sample");
    	strcpy(szDbName, "Basic");
    	strcpy(szFileName, "Basic");
    	strcpy(pszDTSMember, "Q-T-D");
    	strcpy(pszAliasTable, "Default");
    	strcpy(pszAlias, "QuarterToDate");

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

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

    	if(sts)
    	{
    		printf("Could not open outline\n");
    		return sts;
    	}
    	sts = EssOtlSetDTSMemberAlias(hOutline, pszDTSMember, pszAlias , pszAliasTable);
    	if(sts)
    	{
    		printf("Could not set DTS member alias. Error is %d\n", sts);
    	}

    	sts = EssOtlWriteOutline(hOutline, &Object);
    	if(sts)
    	{
    		printf("Could not write outline\n");
    		return sts;
    	}

    	sts = EssOtlRestructure(hCtx, ESS_DOR_ALLDATA);
    	if(sts)
    	{
    		printf("Could not restructure outline\n");
    		return sts;
    	}

    	memset (&pState, 0, sizeof(ESS_PROCSTATE_T));
    	sts = EssGetProcessState(hCtx, &pState);
    	{
    		while ((sts == ESS_STS_NOERR ) && (pState.State != ESS_STATE_DONE))
    		{
    			memset (&pState, 0, sizeof(ESS_PROCSTATE_T));
    			sts = EssGetProcessState(hCtx, &pState);
    		}
    	}

    	sts = EssUnlockObject(hCtx, ESS_OBJTYPE_OUTLINE, szAppName, szDbName, szFileName);
    	if (sts)
    	{
    		printf("Could not unlock outline\n");
    		return sts;
    	}

    	EssOtlCloseOutline(hOutline);
    	return sts;
    }

See Also

EssOtlDeleteDTSMemberAlias
EssOtlEnableDTSMember
EssOtlGetEnabledDTSMembers
EssOtlGetDTSMemberAlias