Formula: IExpression;
The Formula property returns the expression, which binds cube fact to data source fields or the expression, which determines a calculated cube value.
Executing the example requires a standard cube with the STD_CUBE identifier. There are at least two elements in the cube fact dimension.
Sub UserProc;
Var
MB: IMetabase;
StdCube: IStandardCube;
Dest: IStandardCubeDestination;
StdDataset: IStandardCubeDataset;
Dataset: IDatasetModel;
Field: IDatasetModelField;
FactBind: IStandardCubeFactBinding;
v: Variant;
Begin
MB := MetabaseClass.Active;
StdCube := MB.ItemById("STD_CUBE").Edit As IStandardCube;
Dest := StdCube.Destinations.Item(0);
StdDataset := Dest.Datasets.Item(0);
Dataset := StdDataset.Dataset;
Field := Dataset.Fields.Item(0);
FactBind := Dest.FactBindings(StdDataset).Binding(1);
FactBind.Formula.AsString := (Dataset As IMetabaseObject).Id + "." + Field.Id;
Debug.WriteLine(FactBind.Formula.AsString);
v := FactBind.FactKey;
FactBind := Dest.CalcBindings.Binding(2);
FactBind.Formula.AsString := "@[1]*3.14";
(StdCube As IMetabaseObject).Save;
End Sub UserProc;
After executing the example binding for the first two elements of the cube fact dimension is set up. The first cube fact is bound to the first data source field. The second fact is determined as a calculated fact, its value is calculated on the basis of the first fact by the specified formula.
See also: