ICalculatedCubeInstance.CreateSourceCoord

Syntax

CreateSourceCoord(Source: ICubeInstanceSource): ICalculatedCubeInstanceCoord;

Parameters

Source. Source cube for which coordinate must be created.

Description

The CreateSourceCoord method creates an object that is 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(NullAs ICalculatedCubeInstance;
    
//Get coordinate in calculated cube
    Coord := CubeInst.CreateCoord;
    Coord.MatrixCoord.Item(
0) := 0;
    Coord.MatrixCoord.Item(
1) := 0;
    
//Get coordinate from source
    SourceCoord := CubeInst.CreateSourceCoord(CubeInst.Sources.Item(0));
    SourceCoord.MatrixCoord.Item(
0) := 0;
    SourceCoord.MatrixCoord.Item(
1) := 0;
    Formulas := CubeInst.Formula(Coord);
    
//Get formula by 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