IMsCrossDimensionAggregationTransform.AgregationMethod

Syntax

AgregationMethod: MsAgregationMethodType;

Description

The AgregationMethod property selects aggregation method.

Comments

Use the IMsCrossDimensionAggregationTransform.Expression property to get aggregation expression.

Example

Executing the example requires that the repository contains a form with the Button component with the BUTTON1 identifier, the LanerBox component with the LANERBOX1 identifier and the UiErAnalyzer component with the UIERANALYZER1 identifier. Specify UIERANALYZER1 as a data source for the LANERBOX1 component. The time series database workbook must be loaded to the UIERANALYZER1 component.

The example is a handler of the OnClick event for the BUTTON1 button.

Add links to the Cubes, Dimensions, Express, Laner, and Metabase system assemblies. Ms, Rds.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    mb: IMetabase;
    Laner: ILaner;
    CalcSerie: ILanerCalculateSerie;
    Transform: IMsFormulaTransform;
    Selector: IMsFormulaTransformSelector;
    Formula: IMsFormula;
    Method: IMsMethod;
    Aggr: IMsCrossDimensionAggregationTransform;
    TransformVar: IMsFormulaTransformVariable;
    Options: IMsCrossDimensionAggregationOptions;
    FilterList: IMsAggregationFilterList;
    Filter: IMsAggregationFilter;
    Rubr: IRubricator;
    Attributes: IMetaAttributes;
    DictDescr: IMetabaseObjectDescriptor;
    FilterDimension: IMetabaseObject;
    DimInst: IDimInstance;
    Selection: IDimSelection;
    i: Integer;
Begin
    mb := MetabaseClass.Active;
    Laner := UiErAnalyzer1.ErAnalyzer.Laner;
    Laner.BeginUpdate;
    CalcSerie := Laner.Series.AddCalculateSerie("Aggregation");
    Transform := CalcSerie.Transform.Transform As IMsFormulaTransform;
    Selector := Transform.CreateSelector;
    TransformVar := Transform.Outputs.Item(0);
    Selector.Slice := TransformVar.Slices.Add(Null);
    Formula := Transform.Transform(Selector);
    Formula.Kind := MsFormulaKind.CrossDimensionAggregation;
    Method := Formula.Method;
    // Set up aggregation
    Aggr := Method As IMsCrossDimensionAggregationTransform;
    // Set aggregation method
    Aggr.AgregationMethod := MsAgregationMethodType.Sum;
    // Determine additional aggregation parameters
    Options := Aggr.Options;
    Options.Threshold := 0;
    Options.Level := False;
    Options.Rebase := False;
    // Set up aggregation filter
    FilterList := Aggr.Filter;
    FilterList.Clear;
    Rubr := Laner.RubricatorInstance.Rubricator;
    Attributes := Rubr.Facts.Attributes;
    DictDescr := Attributes.FindById("COUNTRY").ValuesObject;
    Filter := FilterList.Add(DictDescr.Bind As IDimensionModel);
    FilterDimension := Filter.FilterDimension As IMetabaseObject;
    DimInst := FilterDimension.Open(NullAs IDimInstance;
    Selection := DimInst.CreateSelection;
    For i := 0 To 3 Do
        Selection.SelectElement(i, False);
    End For;
    Filter.AggregationSelection := Selection;
    // Set the dimension, by which aggregation is executed
    DictDescr := Attributes.FindById("INDICATOR").ValuesObject;
    Aggr.AggregationDimenson := DictDescr.Bind As IDimensionModel;
    // Set aggregation expression
    Aggr.Expression.AsString := "{BCA[t]}";
    LanerBox1.ExecuteOperation(LanerBoxOperation.Refresh);
    Laner.EndUpdate;
End Sub Button1OnClick;

After executing the example the AGGREGATION calculated series calculated by the aggregation method will be added to the LanerBox component. Aggregation is calculated as a sum of the BCA indicator values for the first four countries of the dictionary, to which the COUNTRY attribute refers. For example:

See also:

IMsCrossDimensionAggregationTransform