SubsetMDXSet

SubsetMDXSet applies a specified MDX expression to a public or temporary subset.

If the passed MDX expression is valid, the specified subset is saved as a dynamic subset defined by the MDX expression.

If the passed MDX expression is an empty string, the subset is converted to a static subset that contains the elements that are in place when SubsetMDXSet is executed.

The function returns the number of elements that the subset contains.

This function is valid in TM1® TurboIntegrator processes only.

Syntax

SubsetMDXSet(DimName, SubName, MDX_expression);
Argument Description
DimName The parent dimension of the subset.
SubName The subset to which you want to apply the MDX expression. SubName must be a public or temporary subset. If this subset does not exist, an error is logged.
MDX_expression The MDX expression that you want to apply to the subset. If the MDX expression is invalid, TurboIntegrator processing stops, the subset is not modified, and an error is logged.

If the MDX_expression argument is an empty string, the subset is converted to a static subset.

Examples

SubsetMdxSet( 'YZProducts', 'mySub1', '{ Filter( [YZProducts].[YZProducts].members, IsLeaf( [YZProducts].[YZProducts].currentmember ) ) }' ); 

This example updates the mySub1 subset to a dynamic subset that contains the current leaf elements of the YZProducts dimension. When leaf elements are added or removed from the YZProduct dimension, the mySub1 subset is dynamically updated to reflect the changes in the parent dimension.

One possible use of the SubsetMDXSet function is to apply an MDX expression to update an existing subset, and then immediately convert the subset to static.

SubsetMDXSet( 'YZProducts', 'mySub1', '{ [YZProducts].[YZProducts].[level000].members }' ); 
SubsetMDXSet( 'YZProducts', 'mySub1', '' ); 

This two-call sequence updates the mySub1 subset to a static subset that contains the current top-level elements of the YZProducts dimension.

The first call of SubsetMDXSet applies the { [YZProducts].[YZProducts].[level000].members } MDX expression to the mysub1 subset, resulting in a dynamic subset that includes all top-level (level 0) elements of the YZProducts dimension.

The second call of SubsetMDXSet passes an empty string as the MDX_expression argument, so the mysub1 subset is converted to a static subset.