ICalculatedCubeInstanceCoord.IsReference

Syntax

IsReference: Boolean;

Description

The IsReference property determines whether the coordinate is passed using the link.

Comments

If the property is set to True, not the value by this coordinate, but the link to the coordinate, described by the ICalculatedCubeInstanceCoord interface, is passed on calculating the formula. The property is set to False by default, actual value by this coordinate is passed to formulas. Setting the property to True is equivalent to setting the @ character before coordinate in the formula editor of calculated cube.

Fore Example

Executing the example requires a calculated cube with the Calc_Cube identifier, the cube has two dimensions. Also, a unit with the Calc_Functions identifier should be present, which implements calculated cube functions. There is the Test function among the others, which signature has a single parameter with the ICalculatedCubeInstanceCoord type. Also, add links to the Cubes, Matrix and Metabase system assemblies.

Sub EditFormula;
Var
    MB: IMetabase;
    CubeInst: ICalculatedCubeInstance;
    Formulas: ICalculatedCubeFormulas;
    Formula: ICalculatedCubeFormula;
    Coord, SourceCoord: ICalculatedCubeInstanceCoord;
Begin
    MB := MetabaseClass.Active;
    CubeInst := MB.ItemById("Calc_Cube").Open(NullAs ICalculatedCubeInstance;
    //Coordinate in calculated cube
    Coord := cubeInst.CreateCoord;
    Coord.MatrixCoord.Item(0) := 0;
    Coord.MatrixCoord.Item(1) := 0;
    //Formulas by this coordinate
    Formulas := CubeInst.Formula(Coord);
    Formula := Formulas.Item(0);
    //Source cube coordinate
    SourceCoord := CubeInst.CreateSourceCoord(CubeInst.Sources.Item(0));
    SourceCoord.MatrixCoord.Item(0) := 0;
    SourceCoord.MatrixCoord.Item(1) := 0;
    //Pass coordinate by link
    SourceCoord.IsReference := True;
    //Set formula using source cube coordinate
    Formula.Expression.AsString := "Calc_Functions.Test(" + SourceCoord.AsTerm + ")";
    //Save formulas
    Formulas.Save;
    CubeInst.SaveFormulas;
End Sub EditFormula;

On executing the example the following formula is set by the specified source cube coordinate: the applied function is called, to which the cube coordinate is passed by the link.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    CubeInst: ICalculatedCubeInstance;
    Formulas: ICalculatedCubeFormulas;
    Formula: ICalculatedCubeFormula;
    Coord, SourceCoord: ICalculatedCubeInstanceCoord;
Begin
    MB := Params.Metabase;
    CubeInst := MB.ItemById["Calc_Cube"].Open(NullAs ICalculatedCubeInstance;
    //Coordinate in calculated cube
    Coord := cubeInst.CreateCoord();
    Coord.MatrixCoord.Item[0] := 0;
    Coord.MatrixCoord.Item[1] := 0;
    //Formulas by this coordinate
    Formulas := CubeInst.Formula[Coord];
    Formula := Formulas.Item[0];
    //Source cube coordinate
    SourceCoord := CubeInst.CreateSourceCoord(CubeInst.Sources.Item[0]);
    SourceCoord.MatrixCoord.Item[0] := 0;
    SourceCoord.MatrixCoord.Item[1] := 0;
    //Pass coordinate by link
    SourceCoord.IsReference := True;
    //Set formula using source cube coordinate
    Formula.Expression.AsString := "Calc_Functions.Test(" + SourceCoord.AsTerm + ")";
    //Save formulas
    Formulas.Save();
    CubeInst.SaveFormulas();
End Sub;

See also:

ICalculatedCubeInstanceCoord