Groups: IMsDimIteratorAdvancedFilterConditionGroups;
The Groups property returns the collection of advanced filter group conditions.
Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier that contains a calculation block. A data consumer containing at least two dimensions should be selected for the calculation block. Advanced filter and four filtering conditions are set for the first dimension.
Add links to the Algo, Metabase, Ms system assemblies and also add links to the assemblies that are required to work with calculation algorithms.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Algo, CalcBlock: ICalcObject;
List: ICalcObjectsList;
CalcAlgo: ICalcAlgorithm;
Block: ICalcBlock;
AdvancedFilter: IMsDimIteratorAdvancedFilter;
Condition: IMsDimIteratorAdvancedFilterCondition;
Group: IMsDimIteratorAdvancedFilterConditionGroup;
MultiDimIter: IMsCalculationChainMultiDimIterator;
Dims: IMsDimIteratorDimensions;
Dim: IMsDimIteratorDimension;
Filter: IMsDimIteratorFilter;
Groups: IMsDimIteratorAdvancedFilterConditionGroups;
CountDims: Integer;
Begin
MB := MetabaseClass.Active;
// Get calculation algorithm
MObj := MB.ItemById("ALGORITHM");
Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
CalcAlgo := Algo As ICalcAlgorithm;
// Get list of calculation algorithm objects
List := CalcAlgo.Items;
// Get calculation block
CalcBlock := List.Item(0);
Block := CalcBlock As ICalcBlock;
// Get multidimensional iterator of calculation block
MultiDimIter := Block.Iterator;
// Get collection of data consumer dimensions
Dims := MultiDimIter.Dimensions;
// Get the first dimension of data consumer
CountDims := Dims.Count;
Dim := Dims.Item(CountDims - 1);
// Set up advanced filter for obtained dimension
Filter := Dim.Filter;
AdvancedFilter := Filter.AdvancedFilter;
// Get collection of groups of filtering conditions
Groups := AdvancedFilter.Groups;
// Delete existing groups of conditions
Groups.Clear;
// Add a new group of conditions
Group := Groups.Add;
// Add filtering conditions with the 2 and 3 indexes to the group
Condition := AdvancedFilter.Item(2);
Group.AddCondition(Condition);
Condition := AdvancedFilter.Item(3);
Group.AddCondition(Condition);
// Save changes in calculation block
Block.SaveObject;
End Sub UserProc;
After executing the example the third and the fourth filtering conditions are grouped, which are specified in the advanced filter for the data consumer's first dimension in the calculation block.
See also: