ICalculatedCubeInstance.CreateSourceCoord

Syntax

CreateSourceCoord(Source: ICubeInstanceSource): ICalculatedCubeInstanceCoord;

Parameters

Source - source cube, for which data must be created.

Description

The CreateSourceCoord method creates an object that presents a coordinate in a source cube for a calculated cube.

Example

Executing the example requires that the repository contains a calculated cube with the Calc_Cube identifier. The source cube and the calculated cube have two dimensions that are not fixed.

Sub Main;

Var

MB: IMetabase;

CubeInst: ICalculatedCubeInstance;

Coord, SourceCoord: ICalculatedCubeInstanceCoord;

Formulas: ICalculatedCubeFormulas;

Formula: ICalculatedCubeFormula;

Begin

MB := MetabaseClass.Active;

CubeInst := MB.ItemById("Calc_Cube").Open(Null) As ICalculatedCubeInstance;

//Collecting coordinate in the calculated cube

Coord := CubeInst.CreateCoord;

Coord.MatrixCoord.Item(0) := 0;

Coord.MatrixCoord.Item(1) := 0;

//Collecting coordinate from the source

SourceCoord := CubeInst.CreateSourceCoord(CubeInst.Sources.Item(0));

SourceCoord.MatrixCoord.Item(0) := 0;

SourceCoord.MatrixCoord.Item(1) := 0;

Formulas := CubeInst.Formula(Coord);

//Collecting formula by the specified coordinate

Formula := Formulas.Item(0);

Formula.Expression.AsString := SourceCoord.AsTerm + "* 180 / 3.14";

Formulas.Save;

CubeInst.SaveFormulas;

End Sub Main;

After executing the example the formula is changed for the collected cube coordinate. The term, referring to an appropriate coordinate in the source cube, is used in the expression.

See also:

ICalculatedCubeInstance