Head

Returns the first n members or tuples present in a set.

Syntax

Head ( set [,numeric value expression ] )

set The set from which to take items.
numeric value expression The count of items to take from the beginning of the set. If omitted, the default is 1. If less than 1, an empty set is returned. If the value exceeds the number of tuples in the input set, the original set is returned.

Example

Example 1

This example uses the following part of the Sample Basic outline:

Children of Product

The following expression

[Product].children

returns the set:

{ [100], [200], [300], [400], [Diet] }

Therefore, the following expression

 Head (
  [Product].children, 2) 

returns the first two members of the previous result set:

{ [100], [200] }

Example 2

This example uses the following parts of the Sample Basic outline:

Children of member 100 Children of member South Gen 2 of Year dimension

The following expression

 CrossJoin ( [100].children, [South].children )

returns the set:

{ ([100-10], Texas), ([100-10], Oklahoma), ([100-10], Louisiana), ([100-10], [New Mexico]),
  ([100-20], Texas), ([100-20], Oklahoma), ([100-20], Louisiana), ([100-20], [New Mexico]),
  ([100-30], Texas), ([100-30], Oklahoma), ([100-30], Louisiana), ([100-30], [New Mexico]) }

And the following expression

Head ( CrossJoin ([100].children, [South].children), 8 )

returns the first 8 tuples of the previous result set:

{ ([100-10], Texas), ([100-10], Oklahoma), ([100-10], Louisiana), ([100-10], [New Mexico]),
  ([100-20], Texas), ([100-20], Oklahoma), ([100-20], Louisiana), ([100-20], [New Mexico]) } 

Additionally, the following expression

([Year].generations(2).members)

returns the set of members comprising the second generation of the Year dimension:

{ [Qtr1], [Qtr2], [Qtr3], [Qtr4] }

Therefore, the following query

SELECT
  {([Year].generations(2).members)}
ON COLUMNS,
Head (
 CrossJoin (
  [100].children, [South].children), 8
     ) 
ON ROWS
FROM Sample.Basic 

returns the grid:

Qtr1 Qtr2 Qtr3 Qtr4
100-10 Texas 489 536 653 547
Oklahoma 87 92 128 211
Louisiana 93 106 128 137
New Mexico 76 101 122 70
100-20 Texas 206 199 152 82
Oklahoma 84 66 55 79
Louisiana 119 158 171 104
New Mexico -103 -60 -97 -18

©2004 Hyperion Solutions Corporation. All Rights Reserved.
http://www.hyperion.com