GetSelection(Selection: IDimSelection);
Selection. Dimension elements selection.
The GetSelection method returns selection of dimension elements that determines the data range.
Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier. Segments must be determined in this database. The first segment must be a data range limited by elements selection by the factors attribute with the COUNTRY identifier. The attribute is a reference to a dictionary.
Sub Main;
Var
mb: IMetabase;
rubInst: IRubricatorInstance;
Rub: IRubricator;
Segs: IRubricatorSegments;
Seg: IRubricatorSegment;
segmFact: IRubricatorFactorsSegment;
Attr: IMetaAttribute;
Dict: IMetabaseObject;
DI: IDimInstance;
Sel: IDimSelection;
Begin
mb := MetabaseClass.Active;
Rub := mb.ItemById("OBJ_RUBRICATOR").Bind As IRubricator;
rubInst := (Rub As IMetabaseObjectDescriptor).Open(Null) As IRubricatorInstance;
Segs := rubInst.Segments;
Seg := Segs.Item(0).Edit;
segmFact := Seg As IRubricatorFactorsSegment;
Attr := Rub.Facts.Attributes.FindById("COUNTRY");
Seg.Attribute := Attr;
Dict := Attr.ValuesObject.Bind;
DI := Dict.Open(Null) As IDimInstance;
Sel := DI.CreateSelection;
segmFact.GetSelection(Sel);
Sel.InvertAll;
segmFact.SetSelection(Sel);
Seg.Save;
End Sub Main;
After executing the example selection of dimension elements, determining the first data range, is obtained. Then this selection is changed to the opposite, changes in the selection of data segment elements are saved.
See also: