IMsModel.ReplaceOutputVariable

Syntax

ReplaceOutputVariable(Index: Integer; Variable: IMsVariable);

Parameters

Index. Index of the position of the variable that should be replaced. This parameter is only relevant for methods that have more than one output variable (system of equations, error correction model), in all other cases, 0 must be passed as index.

Variable. Variable that is set as an output one.

Description

The ReplaceOutputVariable method replaces output variable.

Comments

Parameters, set for initial model, are saved only in case if the structure of new and old variables is the same.

Example

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Model: IMsModel;
    Variable: IMsVariable;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemByIdNamespace("MODEL_1", MB.ItemById("KONT_MODEL").Key).Edit;
    Model := MObj As IMsModel;
    Variable := MB.ItemByIdNamespace("Var_11", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
    Model.ReplaceOutputVariable(0, Variable);
    MObj.Save;
End Sub UserProc;

After executing the example the output variable is changed for the model with the MODEL_1 identifier.

See also:

IMsModel