Compartilhar via


Usando funções de tupla

Uma função de tupla recupera uma tupla de um conjunto ou recupera uma, resolvendo a representação de cadeia de caracteres de uma tupla.

Funções de tupla, como funções membro e funções de conjunto, são essenciais para negociar as estruturas multidimensionais encontradas no Analysis Services.

Há três funções de tupla em MDX, Atual (MDX),Item (Tupla) (MDX) e StrToTuple (MDX). A consulta de exemplo a seguir mostra como usar cada uma:

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]  

Consulte Também

Funções (sintaxe de MDX)
Usando as funções de membro
Usando funções de conjunto