IntersectWith(Selection: IDimSelection);
Selection. Group of dictionary elements that should be kept in the selection.
The IntersectWith method leaves selected only the elements included in the intersection with the sent selection.
To execute the example, place on the form the Button component with the Button1 identifier, the DimensionTree component with the DimensionTree1 identifier, and the UiDimension component with the UiDimension1 identifier. Specify UiDimension1 as a data source for DimensionTree1. A table dictionary is a data source for UiDimension1.
Add links to the Dimensions, ExtCtrls, Forms, Metabase system assemblies.
The example is a handler of the OnClick event for the Button1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
dim: IDimInstance;
hier: IDimHierarchyInstance;
DimSelect: IDimSelection;
i: Integer;
Begin
dim := UiDimension1.DimInstance;
hier := dim.Hierarchies.Item(0);
UiDimension1.Selection.SelectAll;
UiDimension1.Selection.LimitToHierarchy(hier);
// Select alternative hierarchy
UiDimension1.Selection.SelectHierarchy := hier;
DimSelect := Dim.CreateSelection;
// Select elements with Step 2
For i:=0 To Dim.Elements.Count-1 Step 2 Do
DimSelect.SelectElement(i,False);
End For;
UiDimension1.Selection.IntersectWith(DimSelect);
End Sub Button1OnClick;
As source data, consider the array of elements: a1, a2, a3, a4, a5, a6, a7. Alternative hierarchy includes the elements: a1, a2, a4, a5, a7. After executing the example, the following elements are kept selected: a1, a5, a7.
See also: