AddIterator(CycleName: String): IMsCalculationChainIterator;
AddIterator(CycleName: string): Prognoz.Platform.Interop.Ms.IMsCalculationChainIterator;
CycleName. Name of added cycle.
The AddIterator method adds a cycle to metamodel calculation chain.
Executing the example requires that the repository contains a table dictionary with the TABLE_DICTIONARY identifier and a modeling container with the MODELING_CONTAINER identifier. The container must have a metamodel with the META_MODEL identifier.
Add links to the Dimensions, Metabase, Ms system assemblies.
Sub UserAddIterator;
Var
pMetabase: IMetabase;
pModelSpace: IMetabaseObjectDescriptor;
pMetaModel: IMsMetaModel;
pChain: IMsCalculationChainEntries;
pCycle: IMsCalculationChainIterator;
pDimInstance: IDimInstance;
pSelection: IDimSelection;
pParam: IMsModelParam;
Begin
pMetabase := MetabaseClass.Active;
// Get modelling container
pModelSpace := pMetabase.ItemById("MODELING_CONTAINER");
// Get metamodel
pMetaModel := pMetabase.ItemByIdNamespace("META_MODEL", pModelSpace.Key).Edit As IMsMetaModel;
// Get metamodel calculation chain
pChain := pMetaModel.CalculationChain;
pMetaModel.Params.Clear;
// Create a metamodel parameter
pParam := pMetaModel.Params.Add;
pParam.Id := "PARAM_ITERATOP";
pParam.Name := "Cyclic parameter";
// Bind parameter to table dictionary
pParam.LinkedObject := pMetabase.ItemById("TABLE_DICTIONARY");
// Create a cycle in metamodel
pCycle := pChain.AddIterator("Cycle");
pDimInstance := pMetabase.ItemById("TABLE_DICTIONARY").Open(Null) As IDimInstance;
// Set selection for cycle calculation
pSelection := pDimInstance.CreateSelection;
pSelection.SelectAll;
pCycle.Selection := pSelection;
// Set parameter used for cycle calculation
pCycle.Parameter := pParam;
// Save changes
(pMetaModel As IMetabaseObject).Save;
End Sub UserAddIterator;
After executing the example the cycle with parameter is added to the calculated circuit of metamodel. Cycle calculation is executed by all elements of the dictionary.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
pMetabase: IMetabase;
pModelSpace: IMetabaseObjectDescriptor;
pMetaModel: IMsMetaModel;
pChain: IMsCalculationChainEntries;
pCycle: IMsCalculationChainIterator;
pDimInstance: IDimInstance;
pSelection: IDimSelection;
pParam: IMsModelParam;
Begin
pMetabase := Params.Metabase;
// Get modeling container
pModelSpace := pMetabase.ItemById["MODELING_CONTAINER"];
// Get metamodel
pMetaModel := pMetabase.ItemByIdNamespace["META_MODEL", pModelSpace.Key].Edit() As IMsMetaModel;
// Get metamodel calculation chain
pChain := pMetaModel.CalculationChain;
pMetaModel.Params.Clear();
// Create a metamodel parameter
pParam := pMetaModel.Params.Add();
pParam.Id := "PARAM_ITERATOP";
pParam.Name := "Cyclic parameter";
// Bind parameter to table dictionary
pParam.LinkedObject := pMetabase.ItemById["TABLE_DICTIONARY"];
// Create a cycle in metamodel
pCycle := pChain.AddIterator("Cycle");
pDimInstance := pMetabase.ItemById["TABLE_DICTIONARY"].Open(Null) As IDimInstance;
// Set selection for cycle calculation
pSelection := pDimInstance.CreateSelection();
pSelection.SelectAll();
pCycle.Selection := pSelection;
// Set parameter used for cycle calculation
pCycle.Parameter := pParam;
// Save changes
(pMetaModel As IMetabaseObject).Save();
End Sub;
See also: