MDAC 2.5 SDK - OLE DB Programmer's Reference
Chapter 25: MDX Grammar


 

MDX Member Value Expressions

Member value expressions identify the elements of the members dimension. The construct is as follows:

<member_value_expression> ::= <member>.{PARENT | FIRSTCHILD | LASTCHILD 
                                        | PREVMEMBER | NEXTMEMBER}
                            | <member>.LEAD(<index>)
                            | <member>.LAG(<index>)

Note   LAG(<index>) is the same as LEAD(–<index>)

                            | <member>.{FIRSTSIBLING | LASTSIBLING}
                            | <dimension>[.CURRENTMEMBER]
                            | <dimension>.DEFAULTMEMBER
                            | <hierarchy>.DEFAULTMEMBER
                            | ANCESTOR(<member>, <level>)
                            | CLOSINGPERIOD(<level>[, <member>])
                            | COUSIN(<member>, <member>)
                            | OPENINGPERIOD(<level>[, <member>])
                            | PARALLELPERIOD([<level>[, <index>
                                             [, <member>]]])

The following table identifies and describes the elements of a Member Value expression.

Element Description
<member>.{PARENT} Names the parent of a member.
<member>.{FIRSTCHILD} Returns the first child of a member according to an implicit natural order. (The children of any member are arranged along this natural order.)
<member>.{LASTCHILD} Names the last child of a member according to the natural order.
<member>.{PREVMEMBER} Names the previous member along the level implied by <member>.
<member>.{NEXTMEMBER} Names the next member along the level implied by <member>.
<member>.LEAD(<index>) Gives the member that is <index> positions away along the member's dimension, in the dimension's natural order. The numbering of the positions is zero-based.

The function <member>.LAG is similar, except that it looks in the opposite direction. If <index> is negative, LEAD becomes LAG, and vice versa.

<dimension>[.CURRENTMEMBER] Gives the current member along <dimension>. The concept of "currency" occurs in functions such as GENERATE, where the semantics include some form of iteration through members of a set.
<member>.{FIRSTSIBLING | LASTSIBLING} Returns the first/last sibling at the parent level of the <member>. For example,
   May.FIRSTSIBLING

returns April, and the expression

   May.LASTSIBLING

returns June (assuming that the parent level is Quarters).


Consumers can check the value of the property MDPROP_MDX_MEMBER_FUNCTIONS to see whether a provider supports these expressions.