Condividi tramite


Utilizzo delle funzioni di tupla

Una funzione di tupla recupera una tupla da un set o mediante la risoluzione della rappresentazione stringa di una tupla.

Le funzioni di tupla, come le funzioni membro e le funzioni set, sono essenziali per negoziare le strutture multidimensionali disponibili in Analysis Services.

Esistono tre funzioni di tupla in MDX, Current (MDX), Item (Tuple) (MDX) e StrToTuple (MDX). Nell'esempio di query seguente viene illustrato l'utilizzo di ciascuna di queste funzioni:

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]  

Vedi anche

Funzioni (sintassi MDX)
Uso delle funzioni membro
Uso delle funzioni sui set