IMsCalculationChainFolder.Contents

Syntax

Contents: IMsCalculationChainEntries;

Description

The Contents property returns the collection of child elements.

Comments

The folder may contain any elements of calculation chain.

Example

Executing the example requires that the repository contains a modeling container with the MS identifier that contains a metamodel with the META identifier and a model with the MODEL_LINEARREGR identifier.

Add links to the Metabase and Ms system assemblies.

Sub UserProc;
Var
    mb: Imetabase;
    MsKey: Integer;
    MetaModel: IMsMetaModel;
    CalcChain: IMsCalculationChainEntries;
    Folder: IMsCalculationChainFolder;
    Model: IMsModel;
Begin
    // Get repository
    mb := MetabaseClass.Active;
    // Get modelling container key
    MsKey := mb.GetObjectKeyById("MS");
    // Get metamodel
    MetaModel := mb.ItemByIdNamespace("META", MsKey).Edit As IMsMetaModel;
    // Get metamodel calculation chain
    CalcChain := MetaModel.CalculationChain;
    // Check if calculation chain contains the MODEL_LINEARREGR model
    If CalcChain.FindById("MODEL_LINEARREGR") = Null Then
        // If there is no metamodel, create a folder in calculation chain
        Folder := CalcChain.AddFolder("Folder with model");
        CalcChain := Folder.Contents;
        // Add the MODEL_LINEARREGR model to created folder
        Model := mb.ItemByIdNamespace("MODEL_LINEARREGR", MsKey).Bind As IMsModel;
        CalcChain.AddModel(Model);
    End If;
    // Save changes
    (MetaModel As IMetabaseObject).Save;
End Sub UserProc;

After executing the example a folder containing a metamodel is created in the calculation chain.

See also:

IMsCalculationChainFolder