IRubricatorSegments.CreateTimeSegment

Syntax

CreateTimeSegment: IRubricatorTimeSegment;

Description

The CreateTimeSegment method adds a time range to the collection.

Example

Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier.

Sub UserProc;
Var
    Mb: IMetabase;
    RubInst: IRubricatorInstance;
    Segs: IRubricatorSegments;
    Seg: IRubricatorSegment;
    Sd: ISecurityDescriptor;
    SegmTime: IRubricatorTimeSegment;
    SegmObject: IMetabaseObjectDescriptor;
Begin
    Mb := MetabaseClass.Active;
    RubInst := Mb.ItemById("«OBJ_RUBRICATOR").Open(NullAs IRubricatorInstance;
    Segs := RubInst.Segments;
    Seg := Segs.CreateTimeSegment As IRubricatorSegment;
    SegmObject := Seg.AsObject;
    Sd := SegmObject.SecurityDescriptor;
    Sd.Edit;
    SegmTime := Seg As IRubricatorTimeSegment;
    SegmTime.DateBegin := DateTime.Parse("01.01.2020");
    SegmTime.DateEnd := DateTime.Parse("01.01.2021");
    Seg.Save;
End Sub UserProc;

After executing the example a segment that represents a time range is created in the time series database. The segment includes indicators data from 01.01.2020 up to 01.01.2021.

See also:

IRubricatorSegments