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 Main;

Var

mb: IMetabase;

rubInst: IRubricatorInstance;

Rub: IRubricator;

Segs: IRubricatorSegments;

Seg: IRubricatorSegment;

Sd: ISecurityDescriptor;

segmTime: IRubricatorTimeSegment;

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.CreateTimeSegment As IRubricatorSegment;

segmObject := Seg.AsObject;

Sd := segmObject.SecurityDescriptor;

Sd.Edit;

segmTime := Seg As IRubricatorTimeSegment;

segmTime.DateBegin := DateTime.Parse("01.01.1999");

segmTime.DateEnd := DateTime.Parse("01.01.2000");

Seg.Save;

End Sub Main;

After executing the example a segment that represents a time range is created in the time series database. The segment includes factors data from 01.01.1999 up to 01.01.2000.

See also:

IRubricatorSegments