IStandardCubeFactBinding.Formula

Syntax

Formula: IExpression;

Description

The Formula property returns the expression, which binds cube fact to data source fields or the expression, which determines a calculated cube value.

Example

Executing the example requires a standard cube with the Stan_Cube identifier. There are at least two elements in the cube fact dimension.

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

StandCub: IStandardCube;

StDataset: IStandardCubeDataset;

Dataset: IDatasetModel;

Field: IDatasetModelField;

FactBind: IStandardCubeFactBinding;

v: Variant;

Begin

MB := MetabaseClass.Active;

MObj := MB.ItemById("Stan_Cube").Edit;

StandCub := MObj As IStandardCube;

StDataset := StandCub.Datasets.Item(0);

Dataset := StDataset.Dataset;

Field := Dataset.Fields.Item(0);

FactBind := StandCub.FactBindings(StDataset).Binding(1);

FactBind.Formula.AsString := (Dataset As IMetabaseObject).Id + "." + Field.Id;

Debug.WriteLine(FactBind.Formula.AsString);

v := FactBind.FactKey;

FactBind := StandCub.CalcBindings.Binding(2);

FactBind.Formula.AsString := "@[1]*3.14";

MObj.Save;

End Sub Main;

After executing the example binding for the first two elements of the cube fact dimension is set up. The first cube fact is linked to the first field of data source, the second one is determined as a calculated fact, its value is calculated on the basis of the first fact by the specified formula.

See also:

IStandardCubeFactBinding