Converts one or more sets to an array for use in a user-defined function.
The SetToArray function converts one or more sets to an array for use in a user-defined function. The number of dimensions in the resulting array is the same as the number of sets specified.
The optional numeric expression can provide the values in the array cells. If a numeric expression is not specified, the cross join of the sets is evaluated in the current context.
The cell coordinates in the resulting array correspond to the position of the sets in the list. For example, there are three sets, SA, SB, and SC. Each of these sets has two elements. The MDX statement, SetToArray(SA, SB, SC), creates the following three-dimensional array:
(SA1, SB1, SC1) (SA2, SB1, SC1) (SA1, SB2, SC1) (SA2, SB2, SC1) (SA1, SB1, SC2) (SA2, SB1, SC2) (SA1, SB2, SC2) (SA2, SB2, SC2)
The return type of the SetToArray function is the VARIANT type, VT_ARRAY. Therefore, the output of the SetToArray function should be used only as input to a user-defined function.
The following example returns an array.
SetToArray([Geography].[Geography].Members, [Measures].[Internet Sales Amount])