共用方式為


使用 Tuple 函數

Tuple 函數可以擷取集合的 Tuple,或是解析 Tuple 的字串表示法來擷取 Tuple。

Tuple 函數跟成員函數和集合函數一樣,對於交涉 Analysis Services 中找到的多維度結構而言不可或缺。

MDX 中有三個 Tuple 函數:Current (MDX)Item (Tuple) (MDX)StrToTuple (MDX)。下列範例查詢會示範如何使用每一個函數:

WITH

//Creates a set of tuples consisting of Years and Countries

SET MyTuples AS [Date].[Calendar Year].[Calendar Year].MEMBERS * [Customer].[Country].[Country].MEMBERS

//Returns a string representation of that set using the Current and Generate functions

MEMBER MEASURES.CURRENTDEMO AS GENERATE(MyTuples, TUPLETOSTR(MyTuples.CURRENT), ", ")

//Retrieves the fourth tuple from that set and displays it as a string

MEMBER MEASURES.ITEMDEMO AS TUPLETOSTR(MyTuples.ITEM(3))

//Creates a tuple consisting of the measure Internet Sales Amount and the country Australia from a string

MEMBER MEASURES.STRTOTUPLEDEMO AS STRTOTUPLE("([Measures].[Internet Sales Amount]" + ", [Customer].[Country].&[Australia])")

SELECT{MEASURES.CURRENTDEMO,MEASURES.ITEMDEMO,MEASURES.STRTOTUPLEDEMO} ON COLUMNS

FROM [Adventure Works]