IMsMetaModelVisualController.Problem

Fore Syntax

Problem: IMsProblem;

Fore.NET Syntax

Problem: Prognoz.Platform.Interop.Ms.IMsProblem;

Description

The Problem property determines the modeling problem, which calculates the metamodel.

Comments

Value of the property must be set to work with modelling scenarios. See IMsMetaModelVisualController.UseScenarios, IMsMetaModelVisualController.CopyScenarioData.

Fore Example

Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier containing a modeling problem with the WEB_PROBLEM identifier. The task must contain the internal metamodel.

Add links to the Metabase, Ms system assemblies.

Sub UseScenarios;
Var
    mb: IMetabase;
    msKey: Integer;
    Problem: IMsProblem;
    Meta: IMsMetaModel;
    MetaVisual: IMsMetaModelVisualController;
Begin
    mb := MetabaseClass.Active;
    // Get modelling container key
    msKey := mb.GetObjectKeyById("MODEL_SPACE");
    // Get modeling problem
    Problem := mb.ItemByIdNamespace("WEB_PROBLEM", msKey).Edit As IMsProblem;
    // Get metamodel  
    Meta := Problem.MetaModel;
    MetaVisual := Meta.VisualController;
    // Set the modeling problem
    MetaVisual.Problem := Problem;
    // Enable scenario modelling
    If Not MetaVisual.UseScenarios Then
        MetaVisual.UseScenarios := True;
    End If;
    // Save changes
    (Problem As IMetabaseObject).Save;
End Sub UseScenarios;

After executing the example for calculation of the metamodel the scenario modelling will be used.

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;
    Problem: IMsProblem;
    Meta: IMsMetaModel;
    MetaVisual: IMsMetaModelVisualController;
Begin
mb := Params.Metabase;
    // Get modelling container key
    msKey := mb.GetObjectKeyById("MODEL_SPACE");
    // Get modeling problem
    Problem := mb.ItemByIdNamespace["WEB_PROBLEM", msKey].Edit() As IMsProblem;
    // Get metamodel  
    Meta := Problem.MetaModel;
    MetaVisual := Meta.VisualController;
    // Set the modeling problem
    MetaVisual.Problem := Problem;
    // Enable scenario modelling
    If Not MetaVisual.UseScenarios Then
        MetaVisual.UseScenarios := True;
    End If;
    // Save changes
    (Problem As IMetabaseObject).Save();
End Sub;

See also:

IMsMetaModelVisualController