IMsAggregationFilter.FilterDimension

Syntax

FilterDimension: IDimensionModel;

Description

The FilterDimension property returns filtered dimension.

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. COUNTRY is the attribute of time series database that refers to the dictionary.

Add links to the Metabase, Ms, Cubes, Dimensions, 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(Null) As 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 mark: " + 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 the 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