# EsbOtlAddDimension

Description

EsbOtlAddDimension() adds a dimension to the outline and sets the member's attributes.

Syntax

    EsbOtlAddDimension (hOutline, pMemberInfo, hPrevSibling, pszDataMbr, phMember)

    ByVal hOutline     As Long
          pMemberInfo  As ESB_MBRINFO_T
    ByVal hPrevSibling As Long
    ByVal pszDataMbr   As String
          phMember     As Long

Parameters

hOutline | Outline context handle.
pMemberInfo | Member information structure defining the member and its attributes.
HPrevSibling | Handle of previous sibling. If this field is ESB_NULL, the dimension becomes the first dimension in the outline. Otherwise, the dimension is placed after the dimension specified in hPrevSibling.
PszDataMbr | Member name of a member in the new dimension that will receive the data values when the outline is restructured. If this field is ESB_NULL, the dimension member itself is used.
phMember | Handle of new member returned from the API.

Return Value

Returns 0 if successful; otherwise one of the following:

Returns 0 if successful; otherwise one of the following:
OTLAPI_BAD_CONSOL
OTLAPI_BAD_MBRNAME
OTLAPI_ERR_ADDDELETEDIMDYNAMICCALC
OTLAPI_ERR_ADDNAMEUSED
OTLAPI_ERR_BADSHARE
OTLAPI_ERR_BADSKIP
OTLAPI_ERR_BADSTORAGE
OTLAPI_ERR_BADSTORAGECATEGORY
OTLAPI_ERR_BADTIMEBAL
OTLAPI_ERR_CURTOOMANYDIMS
OTLAPI_ERR_ILLEGALBOOLEAN
OTLAPI_ERR_ILLEGALCURRENCY
OTLAPI_ERR_ILLEGALDATE
OTLAPI_ERR_ILLEGALNUMERIC
OTLAPI_ERR_ILLEGALTAG
OTLAPI_ERR_LEAFLABEL
OTLAPI_ERR_NONATTRDIMFOLLOWED
OTLAPI_ERR_NOSHAREPROTO
OTLAPI_ERR_NOTIMEDIM

Notes

- This function specifies a member of the new dimension with which you can associate data when the outline is restructured.
- The ESB_MBRINFO_T structure must be created and filled before calling this function.
- To add an attribute dimension, you must call this function.
- To add a dimension that is not an attribute dimension, you can call this function or EsbOtlAddMember().
  - EsbOtlAddDimension() gives you the benefit of selecting any member in the added dimension to be assigned the data values associated with the existing dimensions.
  - If EsbOtlAddMember() is used, the top member (dimension) of the added dimension is used.
- In order for the pszDataMbr field to take effect, the outline must have been opened using EsbOtlOpenOutline() with the fKeepTrans flag set to ESB_YES.
- The member referred to in the pszDataMbr field is added to the new dimension using EsbOtlAddMember() after the dimension is created. If the referred to member doesn't exist when restructuring takes place, the dimension member is used instead.
- For an attribute dimension, you must set the fields of ESB_MBRINFO_T as follows:

  Field | Setting
  usConsolidation | ESB_UCALC_NOOP
  fTwoPass | ESB_FALSE
  fExpense | ESB_FALSE
  usConversion | ESB_CONV_NONE
  usTimeBalance | ESB_TIMEBAL_NONE
  usSkip | ESB_SKIP_NONE
  usShare | ESB_SHARE_DYNCALCNOSTORE
  usStorage | ESB_DIMTYPE_SPARSE
  usCategory | ESB_CAT_ATTRIBUTE
  usStorageCategory | ESB_STORECAT_ATTRIBUTE
  Attribute | Attribute value. One of the following attribute member data types: ESB_ATTRMBRDT_BOOL ESB_ATTRMBRDT_DATETIME ESB_ATTRMBRDT_DOUBLE ESB_ATTRMBRDT_STRING

- An attribute dimension must be associated with a base dimension.
- Attribute dimensions must be placed after base dimensions and standard dimensions.

Example

    Declare Function EsbOtlAddDimension Lib "ESBOTLW"
    (ByVal hOutline As Long, pMemberInfo As ESB_MBRINFO_T,
    ByVal hPrevSibling As Long, ByVal pszDataMbr As String,
    phMember As Long) As Long

    Sub ESB_OtlAddDimension()
    Dim sts As Long
    Dim NewInfo as ESB_OUTLINEINFO_T
    Dim hOutline As Long
    Dim MbrInfo As ESB_MBRINFO_T
    Dim hDimMeasures As Long

    NewInfo.usOutlineType = ESB_DBTYPE_NORMAL
    NewInfo.fCaseSensitive = ESB_FALSE
    NewInfo.fAutoConfigure = ESB_TRUE

    sts = EsbOtlNewOutline(hLocalCtx, NewInfo, hOutline)

    If sts = 0 Then
       MbrInfo.szMember = "Measures"
        sts = EsbOtlAddDimension(hOutline,
         MbrInfo, ESB_NULL, "Profit", hDimMeasures)
    End If
    End Sub

See Also

EsbOtlAddMember()
EsbOtlDelete Dimension()
EsbOtlDeleteMember()
EsbOtlGetMemberInfo()