IRubricatorSegments.CreateFactorsSegment

Syntax

CreateFactorsSegment: IRubricatorFactorsSegment;

Description

The CreateFactorsSegment method adds a data range to the collection.

Example

Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier containing indicator attribute with the COUNTRY identifier that is a link to the dictionary.

To execute the example, add links to the Cubes, Dimensions, Metabase, and Rds system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    RubInst: IRubricatorInstance;
    Segs: IRubricatorSegments;
    Seg: IRubricatorSegment;
    Sd: ISecurityDescriptor;
    Attr: IMetaAttribute;
    Dict: IMetabaseObject;
    DI: IDimInstance;
    Sel: IDimSelection;
    SegmFact: IRubricatorFactorsSegment;
    SegmObject: IMetabaseObjectDescriptor;
Begin
    MB := MetabaseClass.Active;
    RubInst := MB.ItemById("OBJ_RUBRICATOR").Open(NullAs IRubricatorInstance;
    Segs := RubInst.Segments;
    Seg := Segs.CreateFactorsSegment As IRubricatorSegment;
    SegmObject := Seg.AsObject;
    Sd := SegmObject.SecurityDescriptor;
    Sd.Edit;
    Seg.AttributeName := "COUNTRY";
    Attr := RubInst.Rubricator.Facts.Attributes.FindById("COUNTRY");
    Seg.Attribute := Attr;
    Dict := Attr.ValuesObject.Bind;
    DI := Dict.Open(NullAs IDimInstance;
    Sel := DI.CreateSelection;
    Sel.SelectElement(0False);
    Sel.SelectElement(1False);
    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:

IRubricatorSegments