IMsMetaModelVisualController.RenameVariable

Syntax

RenameVariable(EntryKey: Integer; Name: String): Boolean;

Parameters

EntryKey. V.ariable key.

Name. The required name of the variable.

Description

The RenameVariable method renames the specified internal metamodel variable.

Comments

Available values:

To create internal variable, use IMsMetaModelVisualController.CreateVariable method.

Example

Executing the example requires that the repository contains a modeling container with the MS identifier containing a modeling problem with the FILLMODEL identifier. This problem must contain an internal metamodel containing an internal time series database and a model.

Add links to the Metabase, Ms system assemblies.

Sub RenameVariable;
Var
    mb: IMetabase;
    MsObj: IMetabaseObjectDescriptor;
    Meta: IMsMetaModel;
    MetaVisual: IMsMetaModelVisualController;
    Varable: IMsCalculationChainVariable;
    pr: IMsProblem;
    i: Integer;
    ChainEn: IMsCalculationChainEntries;
Begin
    mb := MetabaseClass.Active;
    // Get modeling container
    MsObj := mb.ItemById("MS");
    // Get modeling problem
    pr := mb.ItemByIdNamespace("FILLMODEL", MsObj.Key).Bind As IMsProblem;
    // Get metamodel
    Meta := pr.MetaModel;
    MetaVisual := Meta.VisualController;
    //nbsp;Getnbsp;the model
    ChainEn := Meta.CalculationChain;
    For i := 0 To ChainEn.Count - 1 Do
        If ChainEn.Item(i).Type = MsCalculationChainEntryType.Variable Then
            Varable := ChainEn.Item(i) As IMsCalculationChainVariable;
            MetaVisual.RenameVariable(Varable.Key, Varable.Name + "_");
        End If;
    End For;
End Sub RenameVariable;

After executing the example all internal variables of the specified problem will be renamed.

See also:

IMsMetaModelVisualController