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 a factor attribute with the COUNTRY identifier that refers to a dictionary.
Sub UserProc;
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 UserProc;
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: