Filter: IMatrixModel;
The Filter property returns parameters of composite selection filter.
Filter is set as a matrix. The matrix and the composite dimension should have matching number of dimensions.
Executing the example requires a form, a button positioned on this form and named Button1, the UiDimension component with the UiDimension1 identifier used as a data source for the DimensionTree component. The repository should contain dictionaries with the OBJ_PD_01 and OBJ_PD_02 identifiers. You also need to add links to the Metabase, Cubes, Matrix and Dimensions system assemblies.
This example is a handler of the OnClick event for the Button1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
CompoundDimension: ICompoundDimension;
Mb: IMetabase;
DimFirst: IDimInstance;
DimSecond: IDimInstance;
CreateInfo: IMetabaseObjectCreateInfo;
Source: ICompoundDimensionSource;
SelSet: IDimSelectionSet;
SourceSelSet: IDimSelectionSet;
SelSetFactory: IDimSelectionSetFactory;
CompoundSel: ICompoundSelection;
Obj: IMetabaseObject;
Values: IMetabaseObjectParamValues;
Begin
Mb := MetabaseClass.Active;
SelSetFactory := New DimSelectionSetFactory.Create;
SelSet := SelSetFactory.CreateDimSelectionSet;
SourceSelSet := SelSetFactory.CreateDimSelectionSet;
CreateInfo := Mb.CreateCreateInfo;
CreateInfo.ClassId := MetabaseObjectClass.KE_CLASS_COMPOUNDDIM;
CreateInfo.Permanent := False;
CreateInfo.Name := "Compound dimension";
CreateInfo.Id := "CompoundDimension";
CompoundDimension := Mb.CreateObject(CreateInfo).Edit As ICompoundDimension;
DimFirst := Mb.ItemById("OBJ_PD_01").Open(Null) As IDimInstance;
DimSecond := Mb.ItemById("OBJ_PD_02").Open(Null) As IDimInstance;
Source := CompoundDimension.Sources.Add(0);
Source.Dimensions.Add(DimFirst.Dimension);
Source.Dimensions.Add(DimSecond.Dimension);
SourceSelSet.Add(DimFirst).SelectAll;
SourceSelSet.Add(DimSecond).SelectAll;
CompoundSel := SelSet.AddCompound(0, SourceSelSet);
CompoundSel.Filter := CreateFilterMatrix;
Obj := CompoundDimension As IMetabaseObject;
Values := Obj.Params.CreateEmptyValues;
Values.FindById("SELECTIONS").Value := SelSet;
UiDimension1.Instance := Obj.Open(Values);
UiDimension1.Active := True;
End Sub Button1OnClick;
Function CreateFilterMatrix: IMatrixModel;
Var
result: IMatrixModel;
factory: MatrixFactory;
coord: IMatrixModelCoord;
Begin
factory := New MatrixFactory.Create;
result := factory.CreateMatrixModel(2);
coord := result.CreateModelCoord;
coord.Item(0) := 0;
coord.Item(1) := 1;
result.Item(coord) := 1;
coord.Item(0) := 2;
coord.Item(1) := 1;
result.Item(coord) := 1;
coord.Item(0) := 3;
coord.Item(1) := 3;
result.Item(coord) := 1;
coord.Item(0) := 2;
coord.Item(1) := 2;
result.Item(coord) := 1;
Return result;
End Function CreateFilterMatrix;
After executing the example a composite dictionary is created based on the OBJ_PD_01 and OBJ_PD_02 dictionaries. A filter is applied to dictionary elements. The DimensionTree component shows filtered dictionary elements.
See also: