IMsCalculationChainFolder.Contents

Fore Syntax

Contents: IMsCalculationChainEntries;

Fore.NET Syntax

Contents: Prognoz.Platform.Interop.Ms.IMsCalculationChainEntries;

Description

The Contents property returns the collection of child elements.

Comments

The folder may contain any elements of calculation chain.

Fore 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, 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.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Ms;

Public Shared Sub Main(Params: StartParams);
Var
    mb: Imetabase;
    MsKey: uinteger;
    MetaModel: IMsMetaModel;
    CalcChain: IMsCalculationChainEntries;
    Folder: IMsCalculationChainFolder;
    Model: IMsModel;
Begin
    // Get repository
    mb := Params.Metabase;
    // 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 the created folder
        Model := mb.ItemByIdNamespace["MODEL_LINEARREGR", MsKey].Bind() As IMsModel;
        CalcChain.AddModel(Model);
    End If;
    // Save changes
    (MetaModel As IMetabaseObject).Save();
End Sub;

See also:

IMsCalculationChainFolder