# EsbQueryDatabaseMembers

Description

EsbQueryDatabaseMembers() performs a report-style query to list a selection of database member information.

Syntax

    EsbQueryDatabaseMembers (hCtx, mbrQuery)

    ByVal hCtx     As Long
    ByVal mbrQuery As String

Parameters

hCtx | Essbase VB API context handle.
mbrQuery | Member query string. A query string is a command similar to a report specification. For descriptions of report specifications refer to the Technical Reference. Valid query strings are listed in Notes, below. String must be less than 64 KBytes in length.

Return value

None.

Notes

- The member information returned by this query must be read by calling EsbGetString() until an empty string is returned.
- This function supports an attribute member long name.
- The Member query string consists of a selection string and an optional sorting command followed by an optional output command. The form is:

            mbrQuery ==: <selectionstring> [<sortcommand> [<outputcommand>] ]

- The valid values for member `<selectionstring>` are:

      <CHILDRENOF  -- returns ICHILDRENOF
      <ALLINSAMEDIM
      <DIMTOP
      <OFSAMEGENERATION
      <ONSAMELEVELAS
      <ANCESTORSOF -- returns IANCESTORSOF
      <PARENTOF
      <DESCENDANTSOF -- returns IDESCENDANTSOF
      <ALLSIBLINGSOF
      <LSIBLINGOF

- Valid values for `<sortcommand>` are:

      <SORTASCENDING
      <SORTDESCENDING
      <SORTNONE
      <SORTMBRNAMES
      <SORTALTNAMES
      <SORTMBRNUMBERS
      <SORTDIMNUMBERS
      <SORTLEVELNUMBERS
      <SORTGENERATION

- The form for `<outputcommand>` is:

          <outputcommand> ==: Item [separator] | FORMAT {<item> <separator> }

  - To obtain a one-item list of information on a member, use the following output commands:

        <outputcommand> ==: <MBRNAMES |
                            <ALTNAMES |
                            <MBRNUMBERS |
                            <DIMNUMBERS |
                            <LEVELNUMBERS |
                            <GENERATIONS |
                            <CALCSTRINGS |
                            <UCALCS |
                            <TABSEPARATED |
                            <SPACESEPARATED |
                            <COMMASEPARATED |
                            <NEWLINESEPARATED |
                            <ATTRIBUTES

  - To obtain a list of two or more items of information on a member, use a format specification clause. Specify the items you want listed, their order, and what character to use to separate them. The syntax for a format specification clause is:

        <FORMAT <item> [<separator>] {<item> [<separator>]}

    The valid values for <item> are:

        MBRNAMES
        ALTNAMES
        MBRNUMBERS
        DIMNUMBERS
        LEVELNUMBERS
        GENERATIONS
        CALCSTRINGS
        UCALCS
        ATTRIBUTES

    `ATTRIBUTES` are listed as the number of attributes followed by a tab-separated list of attribute names.
    The valid values for <separator> are:

        TABSEPARATED
        SPACESEPARATED
        COMMASEPARATED
        NEWLINESEPARATED

    If you do not specify a separator, the default is `TABSEPARATED`.
- Here is a sample script:

      login "local" "user1" "password" "" ""
      select "attr" "attr"
      GetMembers "<NEWLINESEPARATED
      <FORMAT {
      MBRNAMES       SPACESEPARATED ALTNAMES    TABSEPARATED
      MBRNUMBERS     SPACESEPARATED DIMNUMBERS  TABSEPARATED
      LEVELNUMBERS   SPACESEPARATED GENERATIONS TABSEPARATED
      CALCSTRINGS    SPACESEPARATED UCALCS      TABSEPARATED
      DIMTYPES       SPACESEPARATED STATUSES    TABSEPARATED
      ATTRIBUTES
      }
      <DESCENDANTS Product "

Access

This function requires the caller to have access to the database, and to have selected it as their active database using EsbSetActive().

Example

    Declare Function EsbQueryDatabaseMembers Lib "ESBAPIW" (ByVal hCtx As Long, ByVal Query As String) As Long

    Sub ESB_QueryDatabaseMembers ()
       Dim sts As Long
       Dim Query As String
       Const szMString = 256
       Dim MString As String * szMString
       Query = "<ALLINSAMEDIM"

       '***********************
       ' Query Database members
       '***********************
       sts = EsbQueryDatabaseMembers (hCtx, Query)

       '**********************
       ' Print out all strings
       '**********************
       If sts = 0 Then
         sts = EsbGetString (hCtx, MString,
               szMString)
         Do While Mid$(MString, 1, 1) <> Chr$(0)
           Print MString
           sts = EsbGetString (hCtx, MString,
                 szMString)
         Loop
       End If
    End Sub

See Also

EsbCheckMemberName()
EsbGetMemberInfo()
EsbGetString()
EsbSetActive()