# EssQueryDatabaseMembers

Description

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

Syntax

    ESS_FUNC_M EssQueryDatabaseMembers (hCtx, mbrQuery);

ESS_HCTX_T | hCtx
ESS_STR_T | mbrQuery

Parameters

hCtx | Essbase API context handle.
mbrQuery | Member query string. A query string is a command similar to a report specification. For valid query strings see the Notes topic.

Return Value

None.

Notes

- The member information returned by this query must be read by calling EssGetString() until a NULL string is returned.
- This function supports an attribute member long name.
- See the Technical Reference for descriptions of report specifications.
- This function can return information on member stored as a relational partition if the Boolean bSpanRelPart has been set by EssSetSpanRelationalPartition. This function supports sorting of members based on member names, aliases (which are the same as member names for relational members) and dimension/generation numbers. For other options, the relational members are treated identically and displayed at the end of the list of members.

  Not all member selection strings are supported in the relational store. This function can return relational information on the following member selection strings:

  - ALLINSAMEDIM
  - DIMTOP
  - CHILDRENOF
  - DESCENDANTSOF
  - PARENTOF
  - ANCESTORSOF
  - ALLSIBILINGSOF
- 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 at least read access (ESS_PRIV_READ) to the database, and to have selected it as their active database using EssSetActive().

Example

    ESS_STS_T
    ESS_GetMembers (ESS_HCTX_T  hCtx,
                    ESS_HINST_T hInst
                   )
    {
       ESS_STS_T        sts = ESS_STS_NOERR;
       ESS_STR_T      mString = NULL;

       sts = EssQueryDatabaseMembers (hCtx,
             "<ALLINSAMEDIM Year");

       if (!sts)
          sts = EssGetString (hCtx, &mString);

       while ((!sts) && (mString != NULL))
       {
          printf ("%s\r\n", mString);
          EssFree (hInst, mString);

          sts = EssGetString (hCtx, &mString);
       }

       return(sts);
    }

See Also

EssCheckMemberName()
EssGetMemberInfo()
EssSetActive()