IMsSelectionControl.GetStubSel

Syntax

GetStubSel(Stub: IVariableStub, [Full: Boolean = false,] [ParamValues: IMetabaseObjectParamValues = Null]): IDimSelectionSet;

Parameters

Stub. Data source

Full. Method of getting data source dimensions.

ParamValues. Collection of dimension parameter values.

Description

The GetStubSel method returns data source dimensions list.

Comments

Available values of the Full parameter:

IMPORTANT. The use of the parameter with the True value may result in the reduced performance and long method execution depending on the number of dimension elements.

The ParamValues parameter is set to Null by default.

When the method is used, dimension sorting is applied for the data source: first, controlling dimensions are returned, then controlled dimensions are returned.

To manage selections of controlling and controlled dimensions:

  1. Set the IMsSelectionControl.IsActive property to True to manage parameters of data source dimensions.

  2. Get the list of dimensions using the IMsSelectionControl.GetStubSel method.

  3. Set controlling dimension selection using the DimSelectionSetFactory class and the IDimSelectionSetFactory.CreateDimSelectionSet, IDimSelectionSet.Add, IDimSelection.SelectElement methods.

  4. Apply selection of controlling dimension elements to change the dimension element set using the IMsSelectionControl.Apply method.

After this, the controlled dimension element set is changed based on the controlling dimension element selection.

Example

Executing the example requires that the repository contains a standard cube with the STD_CUBE identifier, which contains controlling dimensions. For example, the A dimension contains a parameter, and the B dimension controls the A dimension using the configured link, in which the attribute is set, which sends value to the A dimension parameter is set.

Add links to the Cubes, Dimensions, Metabase, Ms system assemblies.

Sub UserProc;
Var 
    
MB: IMetabase;
    Stub: IVariableStub;
    SelControl: IMsSelectionControl;
    SelSet, SelSetNew: IDimSelectionSet;
    Sel: IDimSelection;
    Factory: IDimSelectionSetFactory;   
Begin
    MB := MetabaseClass.Active;
    
// Get standard cube
    Stub := MB.ItemById("STD_CUBE").Bind As IVariableStub;
    
// Create a class to manage dimension parameters
    SelControl := New MsSelectionControl.Create;
    SelControl.IsActive := 
True;
    Debug.WriteLine(
"Before applying controlling dimension element selection:");
    
// Get list of all data source dimension elements
    SelSet := SelControl.GetStubSel(Stub, True);
    
// Display dimension names and elements list in the console
    PrintSelectionSet(SelSet);
    
// Set controlling dimension selection
    Factory := New DimSelectionSetFactory.Create;
    SelSetNew := Factory.CreateDimSelectionSet;
    Sel := SelSetNew.Add(SelSet.Item(
0).Dimension);
    
// Select the second and the fourth elements
    Sel.SelectElement(1False);
    Sel.SelectElement(
3False);
    
// Apply the specified selection for controlled dimensions
    SelSetNew := SelControl.Apply(Stub, SelSetNew);
    Debug.WriteLine(
"After applying controlling dimension element selection:");
    
// Display dimension names and elements list in the console
    PrintSelectionSet(SelSetNew);   
End Sub UserProc;

Sub PrintSelectionSet(SelSet: IDimSelectionSet);
Var
    Copy: IDimSelectionSet;
    Sel: IDimSelection;
Begin
    Copy := SelSet.CreateCopy;
    
For Each Sel In Copy Do
        Sel.SelectAll;
        Debug.WriteLine(
"Dimension: " + Sel.Dimension.Name + "," + " Elements: " + Sel.ToString);
    
End For;
    Debug.WriteLine(
"");
End Sub PrintSelectionSet;

After executing the example, controlling dimension elements are selected, and controlled dimension element sets are changed. The console displays names of all cube dimensions and elements lists for each dimension before and after applying controlled dimension selection.

See also:

IMsSelectionControl