4.
Execute the
query by clicking the Run Query button in the toolbar.
The
Results pane is
populated, and the dataset shown in Illustration 3 appears.
Illustration 3: Result Dataset - Tail() Function with
Omitted Numerical Expression
5.
Re-save the
file as MDX020-2.
6.
Leave the query
open for the next step.
We see
that the "default" value assumed by the function, in the absence of a
specified numeric expression, is 1. Q4 only is returned, on the
column axis, as a result.
7.
Within the
query we have saved as MDX020-2, replace the top comment line of the
query with the following:
-- MDX020-3, Use of Tail() Function
-Numeric Expression < 1
8.
Save the query
as MDX020-3.
9.
Add a comma (",")
after .Children, then a space, and then the numeral -1, into
the following line of the query:
{TAIL([Time].[1998].Children)}
ON COLUMNS,
The
Query pane
appears as depicted in Illustration 4, with the inserted coding circled
in red.
Illustration 4: The Query with Numerical Expression Less
Than 1
10.
Execute the
query by clicking the Run Query button in the toolbar.
We
receive a message box, as shown in Illustration 5, stating that the Sample
Application is unable to display the opened cellset - essentially because
the dataset is empty.
Illustration 5: Message - Empty Cellset
The
message box closes, and we are confronted with the empty cellset (perhaps only
briefly), as expressed by the Sample Application (see Illustration 6.)
Illustration 6: Empty Cellset as Expressed by the Sample
Application
12.
Re-save the
file as MDX020-3.
And so
we see that a numerical expression less than 1 within the Tail()
function results in the return of an empty cellset. Now, let's examine
one last provision for possible numeric input, as we did for the Head()
function in our previous article: what happens when we input a number that is higher
than the total number of tuples in the specified set?
13.
Within the
query we have saved as MDX020-3, replace the top comment line of the
query with the following:
-- MDX020-4, Use of Tail() Function - Numeric Expression > Total Tuples in Set
14.
Save the query
as MDX020-4.
15.
Replace the
numeral -1 with the numeral 6, in the following line of the
existing query:
{TAIL([Time].[1998].Children, -1)} ON COLUMNS,
The
Query pane
appears as depicted in Illustration 7, with the inserted coding circled
in red.
Illustration 7: The Query with Numerical Expression Larger
than Set
16.
Execute the
query by clicking the Run Query button in the toolbar.
The
Results pane is
populated, and the dataset shown in Illustration 8 appears.
Illustration 8: Results of the Modified Numeric Expression
We see
that, even though the numerical expression that we input exceeds the number of
tuples in the specified set (only four Quarters exist in any single Year),
Tail() returns the Full Set only, exactly as we saw with the Head()
function in the previous article.
17.
Re-save the
file as MDX020-4.
We
have explored examples of the behavior of the Tail() function under
various scenarios of numeric expression input for a specified set. We
saw that the function manages potential input by providing a "default"
numeric expression to drive its behavior, with regard to the results it
produces. We also pointed out similarities in operation (with regard to numeric
expressions) between the Head() and Tail() functions.