IMsModelList.Item

Syntax

Item(Index: Integer): IMsModel;

Parameters

Index. Model index in the collection.

Description

The Item method returns a model from the collection by its index.

Example

Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. This container should include a non-linear equation system with the NON_LINEAR_MODEL identifier.

Add links to the Metabase, Ms system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    ModelCont: IMetabaseObjectDescriptor;
    Model: IMsModel;
    Trans: IMsFormulaTransform;
    Formula: IMsFormula;
    Equations: IMsNonLinearEquationsTransform;
    Descript: IMetabaseObjectDescriptor;
    ExtModel: IMsModel;
    ExternalEquations: IMsModelList;
Begin
    mb := MetabaseClass.Active;
    ModelCont := mb.ItemById("CONT_MODEL");
    Descript := mb.ItemByIdNamespace("NON_LINEAR_MODEL", ModelCont.Key);
    Model := Descript.Edit As IMsModel;
    Trans := Model.Transform;
    Formula := Trans.EquationsFormula;
    Equations := Formula.Method As IMsNonLinearEquationsTransform;
// Getting collection of system equations
    ExternalEquations := Equations.ExternalEquations;
    ExtModel := ExternalEquations.Item(0);
    If ExtModel <> Null Then
        ExternalEquations.Remove(0);
    End If;
    // Saving changes
    (Model As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the first external model, if it is contained in the system, is removed from the system of non-linear equations.

See also:

IMsModelList