AddSlice(Value: IMsFormulaTransformSlice): Integer;
Value. Variable slice.
The AddSlice method adds the specified variable slice to report.
After executing the example the AddSlice method returns index of added slice in the report.
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(0) As 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.
See also: