AggregationGroupParamID: String;
The AggregationGroupParamID property determines the identifier of the parameter used for calculation aggregation.
If a value is set for the property, the IMsDetermAggregationTransform.AggregationGroup property is ignored.
In this example, aggregation settings are determined: aggregation group is determined through metamodel parameter that contains the model.
Executing the example requires that the repository contains a time series database with the FC identifier, in which aggregation groups are set. This database contains unique attributes that refer to the DICT_CTR and DICT_IND dictionaries. A modeling container of time series database must include a metamodel with the M_MODEL identifier. This metamodel must contain the PARAM_GROUP parameter that refers to the DICT_CTR dictionary. The calculation chain of metamodel must contain a model with the AGGR_MODEL identifier. Method of model calculation is aggregation (basic) that is calculated as a determinate equation.
Add links to the Cubes, Dimensions, Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Obj: IMetabaseObject;
Ruby: IRubricator;
cmKey: Integer;
rStub: IVariableStub;
RepoKey: Integer;
DictInst: IDimInstance;
ParamDim: IMsParametrizedDimension;
Transform: IMsFormulaTransform;
Model: IMsModel;
MetaModel: IMsMetaModel;
TransformVar: IMsFormulaTransformVariable;
Coord: IMsFormulaTransformCoord;
DetermAggregation: IMsDetermAggregationTransform;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Sel: IDimSelectionSet;
Factory: IDimSelectionSetFactory;
Begin
mb := MetabaseClass.Active;
Ruby := mb.ItemById("FC").Bind As IRubricator;
cmKey := Ruby.ModelSpace.Key;
Obj := mb.ItemByIdNamespace("AGGR_MODEL", cmKey).Edit;
Model := Obj As IMsModel;
Transform := Model.Transform;
Transform.Rubricator := Null;
Transform.Outputs.Clear;
rStub := mb.ItemById("FC").Bind As IVariableStub;
TransformVar := Transform.Outputs.Add(rStub);
Coord := Transform.CreateCoord(TransformVar);
Factory := New DimSelectionSetFactory.Create As IDimSelectionSetFactory;
Sel := Factory.CreateDimSelectionSet;
RepoKey := (Ruby.Database As IMetabaseObject).Key;
DictInst := mb.ItemByIdNamespace("DICT_CTR", RepoKey).Open(Null) As IDimInstance;
Sel.Add(DictInst);
Sel.Item(0).DeselectAll;
DictInst := mb.ItemByIdNamespace("DICT_IND", RepoKey).Open(Null) As IDimInstance;
Sel.Add(DictInst);
Sel.Item(1).DeselectAll;
Sel.Item(1).SelectElement(0, False);
Slice := TransformVar.Slices.Add(Sel);
ParamDim := Slice.ParametrizedDimensions.Item(0);
MetaModel := mb.ItemByIdNamespace("M_MODEL", cmKey).Bind As IMsMetaModel;
ParamDim.Parameter := (MetaModel).Params.FindById("PARAM_GROUP");
Selector := Transform.CreateSelector;
Selector.Slice := Slice;
Formula := Transform.Transform(Selector);
Formula.Kind := MsFormulaKind.DetermAggregation;
DetermAggregation := Formula.Method As IMsDetermAggregationTransform;
Formula.Level := DimCalendarLevel.Year;
DetermAggregation.AggregationExpression := "{PARAM_GROUP}|BCA";
DetermAggregation.AgregationMethod := MsAgregationMethodType.Max;
DetermAggregation.AggregationGroupParamID := "PARAM_GROUP";
Obj.Save;
End Sub UserProc;
After executing the example the aggregation group is determined via the PARAM_GROUP parameter of the metamodel containing the AGGR_MODEL model.
See also: