IMsCalculationChainEntries.AddIterator

Syntax

AddIterator(CycleName: String): IMsCalculationChainIterator;

Parameters

CycleName. Name of added cycle.

Description

The AddIterator method adds a cycle to calculation chain of metamodel.

Example

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 UserProc;
Var
    pMetabase: IMetabase;
    pModelSpace: IMetabaseObjectDescriptor;
    pMetaModel: IMsMetaModel;
    pChain: IMsCalculationChainEntries;
    pCycle: IMsCalculationChainIterator;
    pDimInstance: IDimInstance;
    pSelection: IDimSelection;
    pParam: IMsModelParam;
Begin
    pMetabase := MetabaseClass.Active;
    // 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(NullAs 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;

After executing the example the cycle with parameter is added to the calculated chain of metamodel. Cycle calculation is executed by all dictionary elements.

See also:

IMsCalculationChainEntries