IRubricatorFactorStorage.OpenRevision

Syntax

OpenRevision(Name: String): IRubricatorRevision;

Parameters

Name - name of created revision.

Description

The OpenRevision method creates a new revision to save data.

Example

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

Sub Main;

Var

MB: IMetabase;

RubDesc: IMetabaseObjectDescriptor;

RubrIn: IRubricatorInstance;

Cub: ICubeInstance;

Dest: ICubeInstanceDestination;

FactorStorage: IRubricatorFactorStorage;

Storage: ICubeInstanceStorage;

FactorExec: IRubricatorFactorExecutor;

Exec: ICubeInstanceDestinationExecutor;

Mat: IMatrix;

Ite: IMatrixIterator;

Begin

MB := MetabaseClass.Active;

RubDesc := MB.ItemById("OBJ_RUBRICATOR");

RubrIn := RubDesc.Open(Null) As IRubricatorInstance;

Cub := RubrIn As ICubeInstance;

Dest := Cub.Destinations.DefaultDestination;

FactorStorage := Dest.CreateStorage As IRubricatorFactorStorage;

FactorStorage.DataOverwrite := False;

FactorStorage.FactDataId := "OBT";

FactorStorage.FactDataKind := MetaAttributeKind.Value;

time seriestorage.CurrentRevision := time seriestorage.OpenRevision(Revision for data saving);

Storage := FactorStorage.AsCubeStorage;

FactorExec := Dest.CreateExecutor As IRubricatorFactorExecutor;

Exec := FactorExec.AsCubeExecutor;

Exec.PrepareExecute(Null);

Exec.PerformExecute;

FactorStorage.FactDataMatrix := Exec.Matrix;

Mat := FactorStorage.FactDataMatrix;

Ite := Mat.CreateIterator;

Ite.Move(IteratorDirection.First);

Debug.WriteLine(-----Data before change-----);

While Ite.Valid Do

Debug.WriteLine(Ite.Value);

Ite.Value := Ite.Value + 1;

Ite.ValueFlag := 1;

Ite.Move(IteratorDirection.Next);

End While;

Storage.SaveMatrix(Mat, 1);

Debug.WriteLine(---- Data after change-----);

Ite.Move(IteratorDirection.First);

While Ite.Valid Do

Debug.WriteLine(Ite.Value);

Ite.Move(IteratorDirection.Next);

End While;

End Sub Main;

After executing the example values of all factors are increased by one, saved to a new revision and displayed in the console window.

See also:

IRubricatorFactorStorage