IMsProblemVariablesReport.AddSlice

Fore Syntax

AddSlice(Value: IMsFormulaTransformSlice): Integer;

Fore.NET Syntax

AddSlice(Value: Prognoz.Platform.Interop.Ms.IMsFormulaTransformSlice): integer;

Parameters

Value. Variable slice.

Description

The AddSlice method adds the specified variable slice to report.

Comments

After executing the example the AddSlice method returns index of added slice in the report.

Fore Example

Executing the example requires that the repository contains a modeling container with the MS identifier containing a criterion function with the TARGET_PROBLEM identifier. The repository is also supposed to contain an express report with the MODELLING_REPORT identifier.

Add links to the Express, Matrix, Metabase, Ms, Pivot system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    MsObj: IMetabaseObject;
    Ms: IMsModelSpace;
    Problem: IMsProblem;
    TargetProblem: IMsTargetProblem;
    Transform: IMsFormulaTransform;
    Sleces: IMsFormulaTransformSlices;
    VarReport: IMsProblemVariablesReport;
    DataSource: IMatrixDataSource;
    Eax: IEaxAnalyzer;
Begin
    // Get current repository
    Mb := MetabaseClass.Active;
    // Get modeling container
    MsObj := Mb.ItemById("MS").Bind;
    Ms := MsObj As IMsModelSpace;
    // Get criterion problem
    Problem := Mb.ItemByIdNamespace("TARGET_PROBLEM", MsObj.Key).Bind As IMsProblem;
    // Get output variable in the criterion function
    TargetProblem := Problem.AdditionalDetails.Item(0As IMsTargetProblem;
    Transform := TargetProblem.Model.Transform;
    Sleces := Transform.Outputs.Item(0).Slices;
    VarReport := Problem.CreateVariablesReport;
    // Determine that output variable is included into the report
    VarReport.AddSlice(Sleces.Item(0));
    // Determine modeling container in use
    VarReport.SetModelSpace(Ms);
    // Create a report by variables
    DataSource := VarReport.CreateDataSource;
    Eax := Mb.ItemById("MODELLING_REPORT").Edit As IEaxAnalyzer;
    Eax.OpenMatrixDataSource(DataSource);
    VarReport.SetupSelection(Eax.Pivot.Selection);
    // Save report
    (Eax As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the report is saved to the express report by variables including criterion function output variable data.

Fore.NET Example

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

Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Pivot;

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    MsObj: IMetabaseObject;
    Ms: IMsModelSpace;
    Problem: IMsProblem;
    TargetProblem: IMsTargetProblem;
    Transform: IMsFormulaTransform;
    Sleces: IMsFormulaTransformSlices;
    VarReport: IMsProblemVariablesReport;
    DataSource: IMatrixDataSource;
    Eax: IEaxAnalyzer;
Begin
    // Get current repository
    Mb := Params.Metabase;
    // Get modeling container
    MsObj := Mb.ItemById["MS"].Bind();
    Ms := MsObj As IMsModelSpace;
    // Get criterion problem
    Problem := Mb.ItemByIdNamespace["TARGET_PROBLEM", MsObj.Key].Bind() As IMsProblem;
    // Get output variable in the criterion function
    TargetProblem := Problem.AdditionalDetails.Item[0As IMsTargetProblem;
    Transform := TargetProblem.Model.Transform;
    Sleces := Transform.Outputs.Item[0].Slices;
    VarReport := Problem.CreateVariablesReport();
    // Determine that output variable is included into the report
    VarReport.AddSlice(Sleces.Item[0]);
    // Determine modeling container in use
    VarReport.SetModelSpace(Ms);
    // Create a report by variables
    DataSource := VarReport.CreateDataSource();
    Eax := Mb.ItemById["MODELLING_REPORT"].Edit() As IEaxAnalyzer;
    Eax.OpenMatrixDataSource(DataSource);
    VarReport.SetupSelection(Eax.Pivot.Selection);
    // Save report
    (Eax As IMetabaseObject).Save();
End Sub;

See also:

IMsProblemVariablesReport