Selection: IDimSelection;
Selection: Prognoz.Platform.Interop.Dimensions.IDimSelection;
The Selection property determines selection of primitive elements that is to be set or removed when dictionary selection schema is created.
To determine what should occur with the primitive selection on building a dictionary selection schema (selected/deselected), use the IDimSelectionSchemaPrimitive.Deselect property.
Executing the example requires that the repository contains a table dictionary with the TAB_DIM identifier.
Add links to the Dimensions, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
ObjDesc: IMetabaseObjectDescriptor;
DimInst: IDimInstance;
DimSelect: IDimSelection;
Child: IMetabaseObjectDescriptors;
Gp: IMetabaseObjectDescriptor;
Mobj: IMetabaseObject;
DimSelSchema: IDimSelectionSchema;
SchemaPrimit: IDimSelectionSchemaPrimitive;
i: Integer;
Begin
// Get current repository
MB := MetabaseClass.Active;
// Get dictionary
ObjDesc := MB.ItemById("TAB_DIM");
DimInst := ObjDesc.Open(Null) As IDimInstance;
// Get dictionary selection
DimSelect := DimInst.CreateSelection;
// Add the first and the last elements to the selection
DimSelect.SelectElement(0, False);
DimSelect.SelectElement(DimInst.Elements.Count - 1, False);
// Get dictionary child objects
Child := ObjDesc.Children;
If Child.Count <> 0 Then
// Check all dictionary child objects to find selection schema of dictionary elements
For i := 0 To Child.Count - 1 Do
Gp := Child.Item(i);
// Find selection schema of dictionary elements
If Gp.ClassId = 1030 Then
Mobj := Gp.Edit;
DimSelSchema := Mobj As IDimSelectionSchema;
// Add primitive to dictionary selection schema
SchemaPrimit := DimSelSchema.Add(SelectionPrimitiveType.Specified);
// Determine primitive element selection
(SchemaPrimit As IDimListSelectionPrimitive).Selection := DimSelect;
Mobj.Save;
End If;
End For;
End If;
End Sub UserProc;
After executing the example the primitive that selects elements in the list is added to the dictionary selection schema. The first and the last dictionary elements are added to the primitive selection.
The requirements and result of the Fore.NET example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Dimensions;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
ObjDesc: IMetabaseObjectDescriptor;
DimInst: IDimInstance;
DimSelect: IDimSelection;
Child: IMetabaseObjectDescriptors;
Gp: IMetabaseObjectDescriptor;
Mobj: IMetabaseObject;
DimSelSchema: IDimSelectionSchema;
SchemaPrimit: IDimSelectionSchemaPrimitive;
i, Max: integer;
Begin
// Get current repository
MB := Params.Metabase;
// Get dictionary
ObjDesc := MB.ItemById["TAB_DIM"];
DimInst := ObjDesc.Open(Null) As IDimInstance;
// Get dictionary selection
DimSelect := DimInst.CreateSelection();
// Add the first and the last elements to the selection
DimSelect.SelectElement(0, False);
Max := DimInst.Elements.Count;
DimSelect.SelectElement(((Max - 1) As uinteger), False);
// Get dictionary child objects
Child := ObjDesc.Children;
If Child.Count <> 0 Then
// Check all dictionary child objects to find selection schema of dictionary elements
For i := 0 To Child.Count - 1 Do
Gp := Child.Item[i];
// Find selection schema of dictionary elements
If Gp.ClassId = 1030 Then
Mobj := Gp.Edit();
DimSelSchema := Mobj As IDimSelectionSchema;
// Add primitive to dictionary selection schema
SchemaPrimit := DimSelSchema.Add(SelectionPrimitiveType.sptSpecified);
// Determine primitive element selection
(SchemaPrimit As IDimListSelectionPrimitive).Selection := DimSelect;
Mobj.Save();
End If;
End For;
End If;
End Sub;
See also: