AggregationGroup: IDimElementGroup;
The AggregationGroup property determines the group, by which aggregation is executed.
If the property is set to some value, values of the IMsAggregationFilter.AggregationSelection and IMsAggregationFilter.AggregationParamID properties are reset.
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 indicators of the database that refers to the dictionary. SOUTH_AMERICA is a group of elements of this dictionary.
Add links to the Cubes, Dimensions, Metabase, Ms, Rds system assemblies.
Sub UserProc;
Var
Group: IDimElementGroup;
Mb: IMetabase;
RubrDescr: IMetabaseObjectDescriptor;
Rubr: IRubricator;
msDescr: IMetabaseObjectDescriptor;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Aggr: IMsCrossDimensionAggregationTransform;
FiltesList: IMsAggregationFilterList;
Filter: IMsAggregationFilter;
Attributes: IMetaAttributes;
DictDescr: IMetabaseObjectDescriptor;
Begin
// Get the current repository
Mb := MetabaseClass.Active;
// Get TSDB
RubrDescr := Mb.ItemById("FC");
Rubr := RubrDescr.Bind As IRubricator;
msDescr := Rubr.ModelSpace;
// Get model
Model := Mb.ItemByIdNamespace("MODEL_AGGR", msDescr.Key).Edit As IMsModel;
// Get model calculation parameters
Transform := Model.Transform;
// Get model calculation method
Formula := Transform.FormulaItem(0);
// Get method parameters
Aggr := Formula.Method As IMsCrossDimensionAggregationTransform;
// Get aggregation filter
FiltesList := Aggr.Filter;
// Get dictionary attributes
Attributes := Rubr.Facts.Attributes;
DictDescr := Attributes.FindById("COUNTRY").ValuesObject;
// Add filter
Filter := FiltesList.Add(DictDescr.Bind As IDimensionModel);
Group := Mb.ItemByIdNamespace("SOUTH_AMERICA", DictDescr.Key).Bind As IDimElementGroup;
Filter.AggregationGroup := Group;
// Display information about filter
Debug.WriteLine("AGGREGATIONFILTER");
Debug.WriteLine(" Filter name: " + Filter.Name);
Debug.WriteLine(" Filter selection: " + Group.Selection.ToString);
// Save changes
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example a new filter is added to the extended aggregation model: aggregation is calculated only for elements of the SOUTH_AMERICA group. Then the information about this filter is displayed in the console window.
See also: