Member Value Expressions

OLE DB Programmer's Reference

<member>.{PARENT | FIRSTCHILD | LASTCHILD | PREVMEMBER | NEXTMEMBER}

  • PREVMEMBER gives the previous member along the level implied by <member>.
  • NEXTMEMBER gives the next member along the level implied by <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.)
  • LASTCHILD gives the last child of a member according to the natural order.
  • PARENT gives the parent of a 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, then 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).

ANCESTOR(<member>, <level>)

Returns the ancestor of <member> at the specified level. If <member> has multiple parents, the provider elects which parent member to return.

<level> need not be from the same hierarchy as <member>.

If the level of <member> is equal to <level>, the function returns <member>. For example,

ANCESTOR(USA, Country)

would return USA.

COUSIN(<member>, <ancestor_member>)

Note   The COUSIN function has been deprecated, and providers are no longer required to support it. In most cases, PARALLELPERIOD can be used instead.

This function is best illustrated by an example: The expression

COUSIN([1996].March, [1994])

yields the member [1994].March.

The algorithm to evaluate the COUSIN function call is as follows:

COUSIN(<member1>, <member2>)

The three possible scenarios are as follows:

  1. If the level of <member2> is not at a higher level than <member1>, return immediately. Higher level means a lower level number, because level numbers start at the root (whose level is zero) and increase towards the leaf.
  2. If <member2> is a direct ancestor of <member1>, <member1> returns.
  3. Otherwise:
    • Each member in the hierarchy has a unique sibling-number associated with it. The sibling-number is the rank of a member among its siblings when the siblings are in natural order.
    • Let <ancestor> be a member so that it is the ancestor of <member1> and is a sibling of <member2>.
    • Consider the subtree rooted at <ancestor>. Let P denote the set of sibling-numbers of members traversed in the path from <ancestor> to <member1>. For example, if <ancestor> is North America and <member1> is Seattle, then P = {5, 41}, assuming that the rank of USA among all children of North America is 5 and that the rank of Washington state among all children of USA is 41.
    • Let <m> be the member obtained by starting at <member2> and traversing the path P. Return <m>.

LINKMEMBER(<member>, <hierarchy>)

Returns the equivalent to <member> in <hierarchy>. For example,

LINKMEMBER([Calendar].[1999].[Jan].[12], [Fiscal Year])

might return [Fiscal Year].[1999].[Qtr1].[Jan].[12].

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net