ElementGroup: IDimElementGroup;
The ElementGroup property determines the group of elements based on which cycle should be calculated. If the value of this property is determined, the IMsCalculationChainIterator.Selection property should not be used.
Executing the example requires that the repository contains a dictionary with the D_SOURCE identifier, DICT_GROUP is the group of elements of this dictionary. Also, a modeling container with the CONT_ITERATOR identifier should be present. The metamodel with the META_MODEL identifier must be present in the container.
Sub Main;
Var
pMetabase: IMetabase;
pModelSpace: IMetabaseObjectDescriptor;
pMetaModel: IMsMetaModel;
pChain: IMsCalculationChainEntries;
pCycle: IMsCalculationChainIterator;
pDim: IMetabaseObjectDescriptor;
pElement: IDimElementGroup;
pParam: IMsModelParam;
Begin
pMetabase := MetabaseClass.Active;
pModelSpace := pMetabase.ItemById("CONT_ITERATOR");
pMetaModel := pMetabase.ItemByIdNamespace("META_MODEL", pModelSpace.Key).Edit As IMsMetaModel;
pChain := pMetaModel.CalculationChain;
pChain.Clear;
pMetaModel.Params.Clear;
pParam := pMetaModel.Params.Add;
pParam.Id := "PARAM_1";
pParam.Name := "Param";
pDim := pMetabase.ItemById("D_SOURCE");
pParam.LinkedObject := pDim;
pElement := pMetabase.ItemByIdNamespace("DICT_GROUP", pDim.Key).Bind As IDimElementGroup;
pCycle := pChain.AddIterator(Cycle);
pCycle.ElementGroup := pElement;
pCycle.Parameter := pParam;
(pMetaModel As IMetabaseObject).Save;
End Sub Main;
After executing the example the cycle is added to the metamodel cycle. The cycle calculation is executed by elements, that are the part of the group DICT_GROUP.
See also: