ReverseFormula: IExpression;
The ReverseFormula property returns the expression, by which value of the fact with the ReverseFactKey key is determined.
Executing the example requires a standard cube with the Stan_Cube identifier. There are at least three elements in the cube facts 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;
Field := Dataset.Fields.Item(1);
FactBind := StandCub.FactBindings(StDataset).Binding(2);
FactBind.Formula.AsString := (Dataset As IMetabaseObject).Id + "." + Field.Id;
v := FactBind.FactKey;
FactBind := StandCub.CalcBindings.Binding(3);
FactBind.Formula.AsString := "@[1]*3";
FactBind.ReverseFactKey := v;
FactBind.ReverseFormula.AsString := "((VALUE + 1) * 4 - 2) / 2 ";
MObj.Save;
End Sub Main;
After executing the example binding for the first three elements of the cube facts dimension is set up. The first and second cube facts are linked to two fields of the data source, the third one is determined as calculated, its value is calculated on the basis of the first fact, and also value of the second fact is changed by the specified formula.
See also: