AggregationGroup: IDimElementGroup;
The AggregationGroup property determines the group of dictionary elements used as aggregation group.
Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier. Modeling container of this time series database must contain a problem with the OBJ_PROBLEM identifier. COUNTRY is the custom attribute of time series database that refers to the dictionary. D_COUNTRY is a group of elements of this dictionary.
Sub Main;
Var
MB: IMetabase;
RKey, ContKey, DimKey: Integer;
Obj: IMetabaseObject;
Problem: IMsProblem;
T: IMsTransformationProblem;
CalcSettings: IMsProblemCalculationSettings;
Calculation: IMsProblemCalculation;
Rubricator: IRubricator;
Atrs: IMetaAttributes;
Atr: IMetaAttribute;
AgrGroups: IMsAggregationGroups;
Group: IDimElementGroup;
Begin
MB := MetabaseClass.Active;
RKey := MB.ItemById("OBJ_RUBRICATOR").Key;
ContKey := MB.ItemByIdNamespace("MODELSPACE_TRANSFORMS", RKey).Key;
Obj := MB.ItemByIdNamespace("OBJ_PROBLEM", ContKey).Edit;
Problem := Obj As IMsProblem;
T := New MsTransformationProblem.Create;
Problem.Details := T;
CalcSettings := Problem.CreateCalculationSettings;
CalcSettings.FactIncluded := True;
Obj.Save;
Calculation := Problem.Calculate(CalcSettings);
AgrGroups := Calculation.AggregationGroups;
If AgrGroups.Count > 0 Then
AgrGroups.Clear;
End If;
Rubricator := MB.ItemById("OBJ_RUBRICATOR").Edit As IRubricator;
Atrs := Rubricator.Facts.Attributes;
Atr := Atrs.FindById("COUNTRY");
DimKey := Atr.ValuesObject.Key;
Group := MB.ItemByIdNamespace("D_COUNTRY", DimKey).Edit As IDimElementGroup;
Calculation.AggregationGroup := Group;
Calculation.Run;
Obj.Save;
End Sub Main;
After executing the example the aggregation group is determined for the modeling problem, then the problem is calculated.
See also: