IMsMetaModelVisualController.FillChain

Syntax

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

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 loaded. 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.

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.

See also:

IMsMetaModelVisualController