IMsMetaModelVisualController.FillChain

Fore Syntax

FillChain(ScenarioKeys: Array;
          Period: IMsModelPeriod
          Problem: IMsProblem;
          [Workbook: IMetabaseObject = Null]);

Fore.NET Syntax

FillChain(ScenarioKeys: System.Array;
          Period: Prognoz.Platform.Interop.Ms.IMsModelPeriod
          Problem: Prognoz.Platform.Interop.Ms.IMsProblem;
          Workbook: Prognoz.Platform.Interop.Metabase.IMetabaseObject);

Parameters

ScenarioKeys. Array of scenario keys.

Period. Period of data loading.

Problem. Modeling problem, to which the loading is performed.

Workbook. External workbook, to which the results should be unloaded. Optional parameter.

Description

The FillChain method fills the internal workbook with the metamodel calculation chain data by the set scenarios.

Comments

To filter data by the scenario dictionary, use the Problem parameter. It allows to load data only by the specified problem, not by all scenarios in the modeling container. It is also used to determine whether the scenario modelling is used.

If Workbook = Null, the internal workbook with loaded data is returned by the IMsMetaModelVisualController.ChainWorkbook property or the IMsMetaModelVisualController.Workbook property, if it is required to specify the MsWorkbookType.Chain values as value of the WorkbookType parameter.

Fore 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, Ui system assemblies.

Sub FillChain;
Var
    mb: IMetabase;
    MsObj: IMetabaseObjectDescriptor;
    Meta: IMsMetaModel;
    MetaVisual: IMsMetaModelVisualController;
    ScArr: Array Of Integer;
    Target: IUiCommandTarget;
    pr: IMsProblem;
    ProblDet: IMsProblemDetails;
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;
    // Create an array of scenario keys
    ScArr := New Integer[1];
    // Add the Fact scenario key
    ScArr[0] := -1;
    // Set the period of obtaining data
    ProblDet := pr.Details As IMsProblemDetails;
    // Fill the workbook with the data from the model
    MetaVisual.FillChain(ScArr, ProblDet.Period, pr);
    // Open the workbook
    Target := WinApplication.Instance.GetObjectTarget(MetaVisual.ChainWorkbook);
    Target.Execute("Object.Edit"Null);
End Sub FillChain;

After executing the example the workbook, filled with the data of the metamodel calculation chain is opened.

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;
Imports Prognoz.Platform.Interop.Ui;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    MsObj: IMetabaseObjectDescriptor;
    Meta: IMsMetaModel;
    MetaVisual: IMsMetaModelVisualController;
    ScArr: Array Of Integer;
    Target: IUiCommandTarget;
    Wa: IWinApplicationClass;
    pr: IMsProblem;
    ProblDet: IMsProblemDetails;
Begin
    mb := Params.Metabase;
    // 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;
    // Create an array of scenario keys
    ScArr := New Integer[1];
    // Add the Fact scenario key
    ScArr[0] := -1;
    // Set the period of obtaining data
    ProblDet := pr.Details As IMsProblemDetails;
    // Fill the workbook with the data from the model
    MetaVisual.FillChain(ScArr, ProblDet.Period, pr, Null);
    // Open the workbook
    Wa := New WinApplicationClassClass();
    Target := Wa.Instance[Null].GetObjectTarget(MetaVisual.ChainWorkbook);
    Target.Execute("Object.Edit"NullNull);
End Sub;

See also:

IMsMetaModelVisualController