# EssOtlSetMemberFormula

Description

EssOtlSetMemberFormula() sets the formula for the specified member.

Syntax

    ESS_FUNC_M EssOtlSetMemberFormula (hOutline, hMember, pszFormula);

ESS_HOUTLINE_T | hOutline
ESS_HMEMBER_T | hMember
ESS_STR_T | pszFormula

Parameters

hOutline | Outline context handle.
hMember | Member handle.
pszFormula | Buffer containing the member formula.

Return Value

Returns 0 if successful; otherwise one of the following:

OTLAPI_ERR_SHAREDMEMBERFORMULA
OTLAPI_ERR_MEMBERCALC

Notes

- Use EssOtlDeleteMemberFormula() to remove a member formula.

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_HMEMBER_T      hMember;
    ESS_STR_T          pszFormula;

    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);

    /************  Set Member Formula *************/
    pszFormula = "@VAR(Budget, Actual);";
    if (!sts)
    {
       sts = EssOtlFindMember(hOutline,
             "Variance",&hMember);
    }

    if (!sts && hMember)
    {
       sts = EssOtlSetMemberFormula(hOutline, hMember,
             pszFormula);
    }

See Also

EssOtlGetMemberFormula()
EssOtlDeleteMemberFormula()