Restrictions

The MEMBERS rowset can have up to 12 restrictions. The first 11 are straightforward — they are columns in the MEMBERS rowset: CATALOG_NAME, SCHEMA_NAME, CUBE_NAME, DIMENSION_UNIQUE_NAME, HIERARCHY_UNIQUE_NAME, LEVEL_UNIQUE_NAME, LEVEL_NUMBER, MEMBER_NAME, MEMBER_UNIQUE_NAME, MEMBER_CAPTION, and MEMBER_TYPE. The eleventh restriction, called the tree operation, is not on any particular column of the MEMBERS rowset; rather, it specifies a tree operator. The idea is that the consumer specifies a MEMBER_UNIQUE_NAME restriction and the tree operator (ANCESTORS, CHILDREN, SIBLINGS, PARENT, DESCENDANTS, SELF) to obtain the desired set of members. The SELF operator includes the row for the member itself in the list of returned rows. The following constants are defined in the header file:

// tree operations on restriction 12 on members rowset
#define MDTREEOP_ANCESTORS      0x00000020
#define MDTREEOP_CHILDREN      0x00000001
#define MDTREEOP_SIBLINGS       0x00000002
#define MDTREEOP_PARENT       0x00000004
#define MDTREEOP_SELF         0x00000008
#define MDTREEOP_DESCENDANTS   0x00000010

These designations comprise a bit mask and may be combined.

Effect of Multiple Restrictions

For the most part, specifying more than one restriction results in each of the restrictions being joined by an AND operation. For example, if the consumer specifies a level name restriction of “General Managers” and the member name restriction of “Bill,” then the effect is to find “Bill” among “General Managers.”

The sole exceptions to this rule are the tree operator restrictions. Tree operators operate on a particular member. This member is itself specified by using the other restrictions, such as member name, level name, level number, and so forth. The tree operator interacts with other restrictions as follows:

The consumer can combine more than one tree operator by using the bitwise-OR operator of C/C++. MDTREEOP_CHILDREN | MDTREEOP_SELF returns a rowset containing the list of children of the specified member and the member itself.

The data type for the tree operator restriction that the provider expects in the rgRestrictionsArray parameter of IDBSchemaRowset::GetRowset is DBTYPE_I4.

Note   PARENT_UNIQUE_NAME is not a restriction because specifying the tree operator MEMBER_PARENT can do the same thing.

Possibility of Duplicates

When using the tree operator restriction, it is possible that the resulting rowset will contain duplicate rows. For example, suppose that the non-tree restrictions select two members that are siblings of each other. The tree restriction is MDTREEOP_SIBLINGS. This will cause the list of siblings to be repeated in the resulting rowset because the list of siblings was specified twice.