CustomAggregateFunction: String;
The CustomAggregateFunction property determines a custom method of aggregation calculation.
This property is taken into account if the IStandardCubeFactBinding.AggregationType property is set to CubeFactBindingAggregationType.Custom.
Executing the example requires that the repository contains a standard cube with the OBJ_CUBE identifier. Facts bindings must be set up in this cube.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
StandCub: IStandardCube;
StDataset: IStandardCubeDataset;
FactBind: IStandardCubeFactBinding;
FactBinds: IStandardCubeFactBindings;
FactDimension: IDimInstance;
Iter: IDimIterator;
DimElements: IDimElements;
id: String;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("OBJ_CUBE").Edit;
StandCub := MObj As IStandardCube;
FactDimension := StandCub.FactDimension.OpenDimension;
DimElements := FactDimension.Elements;
Iter := DimElements.Elements.Iterator;
Iter.First;
While Iter.Next Do
id := DimElements.Id(Iter.Element);
StDataset := StandCub.Datasets.Item(0);
FactBinds := StandCub.FactBindings(StDataset);
FactBind := FactBinds.Binding(id);
If FactBind.Formula <> Null Then
FactBind.AggregationType := CubeFactBindingAggregationType.Custom;
FactBind.CustomAggregateFunction := "SUM";
FactBind.DistinctAggregate := True;
FactBind.AggregatedDataType := CubeFactBindingAggregatedDataType.FixedPoint;
FactBind.AggregatedDataTypePrecision := 3;
End If;
End While;
MObj.Save;
End Sub Main;
After executing the example a custom method of aggregation calculation on the data source is determined for cube facts. Numbers with fixed point calculated to within one thousandth are the result of aggregation. Aggregation method - sum.
See also: