SetSelection(Selection: IDimSelection);
Selection. Dimension elements selection.
The SetSelection method determines a 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. This database must contain an attribute of the time series with the COUNTRY identifier that refers to a dictionary.
Sub Main;
Var
mb: IMetabase;
rubInst: IRubricatorInstance;
Rub: IRubricator;
Segs: IRubricatorSegments;
Seg: IRubricatorSegment;
Sd: ISecurityDescriptor;
Attr: IMetaAttribute;
Dict: IMetabaseObject;
DI: IDimInstance;
Sel: IDimSelection;
segmFact: IRubricatorFactorsSegment;
segmObject: IMetabaseObjectDescriptor;
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.CreateFactorsSegment As IRubricatorSegment;
segmObject := Seg.AsObject;
Sd := segmObject.SecurityDescriptor;
Sd.Edit;
Seg.AttributeName := "COUNTRY";
Attr := Rub.Facts.Attributes.FindById("COUNTRY");
Seg.Attribute := Attr;
Dict := Attr.ValuesObject.Bind;
DI := Dict.Open(Null) As IDimInstance;
Sel := DI.CreateSelection;
Sel.SelectElement(0, False);
Sel.SelectElement(1, False);
segmFact := Seg As IRubricatorFactorsSegment;
segmFact.SetSelection(Sel);
Seg.Save;
End Sub Main;
After executing the example a segment that represents a data range is created in the time series database. The segment includes the first and the second dictionary elements, to which the COUNTRY attribute refers.
See also: