ICalculatedCubeFormula.Expression

Syntax

Expression: IExpression;

Description

The Expression property returns an object containing a formula expression.

Example

Executing the example requires that the repository contains a calculated cube with the Calc_Cube identifier. The source cube and the calculated cube contain 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 for the obtained cube coordinate is changed. The term, referring to an appropriate coordinate in the source cube, is used in the expression.

See also:

ICalculatedCubeFormula