IMsAggregationFilter.AggregationSelection

Syntax

AggregationSelection: IDimSelection;

Description

The AggregationSelection property determines the selection that is used to determine aggregated elements.

Comments

If the property is set to some value, values of the IMsAggregationFilter.AggregationSelection and IMsAggregationFilter.AggregationParamID properties are reset.

Example

Executing the example requires that the repository contains a time series database with the FC identifier. The modeling container of this database must include a model with the MODEL_AGGR identifier calculated using extended aggregation method. COUNTRY is the attribute of database time series that refers to the dictionary.

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

Sub UserProc;
Var
    Mb: IMetabase;
    RubrDescr: IMetabaseObjectDescriptor;
    Rubr: IRubricator;
    msDescr: IMetabaseObjectDescriptor;
    Model: IMsModel;
    Transform: IMsFormulaTransform;
    Formula: IMsFormula;
    Aggr: IMsCrossDimensionAggregationTransform;
    FiltesList: IMsAggregationFilterList;
    Filter: IMsAggregationFilter;
    i: Integer;
    Attributes: IMetaAttributes;
    DictDescr: IMetabaseObjectDescriptor;
    FilterDimension: IMetabaseObject;
    DimInst: IDimInstance;
    Selection: IDimSelection;
Begin
    Mb := MetabaseClass.Active;
    RubrDescr := Mb.ItemById("FC");
    Rubr := RubrDescr.Bind As IRubricator;
    msDescr := Rubr.ModelSpace;
    Model := Mb.ItemByIdNamespace("MODEL_AGGR",msDescr.Key).Edit As IMsModel;
    Transform := Model.Transform;
    Formula := Transform.FormulaItem(0);
    Aggr := Formula.Method As IMsCrossDimensionAggregationTransform;
    FiltesList := Aggr.Filter;
    Attributes := Rubr.Facts.Attributes;
    DictDescr := Attributes.FindById("COUNTRY").ValuesObject;
    Filter := FiltesList.Add(DictDescr.Bind As IDimensionModel);
    FilterDimension := Filter.FilterDimension As IMetabaseObject;
    DimInst := FilterDimension.Open(NullAs IDimInstance;
    Selection := DimInst.CreateSelection;
    For i := 0 To 5 Do
        Selection.SelectElement(i, False);
    End For;
    Filter.AggregationSelection:= Selection;
    Debug.WriteLine("AGGREGATION FILTERS");
    For i := 0 To FiltesList.Count - 1 Do
        Filter := FiltesList.Item(i);
        Debug.WriteLine(" Filter name: " + Filter.Name);
        Debug.WriteLine(" Filter selection: " + Filter.AggregationSelection.ToString);
    End For;
    (Model As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the new filter is added to the model of extended aggregation: calculate aggregation only for first six elements of dictionary, to which the COUNTRY attribute refers. After that information about all model filters is displayed in the console window.

See also:

IMsAggregationFilter