CreateVariablesReport: IMsProblemVariablesReport;
The CreateVariablesReport method creates a report on variables for modeling problem calculation.
This method creates a report that does not contain any variables. To add variables, use the IMsProblemVariablesReport.AddVariable and IMsProblemVariablesReport.AddVariableKind methods.
Executing the example requires that the repository includes a modeling container with the OBJ_MS identifier. This container includes a modeling problem with the PROBLEM identifier.
Add links to the Metabase, Ms, Cubes, Matrix, Express, Pivot system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
MsKey: Integer;
Problem: IMsProblem;
CalcSett: IMsProblemCalculationSettings;
ProblCalc: IMsProblemCalculation;
VarReport: IMsProblemVariablesReport;
DataSource: IMatrixDataSource;
Ci: IMetabaseObjectCreateInfo;
Eax: IEaxAnalyzer;
VarList: IVariableStubList;
Varable: IVariableStub;
s: String;
i: Integer;
b: Boolean;
Begin
Mb := MetabaseClass.Active;
MsKey := Mb.ItemById("OBJ_MS").Key;
Problem := Mb.ItemByIdNamespace("PROBLEM", MsKey).Bind As IMsProblem;
CalcSett := Problem.CreateCalculationSettings;
ProblCalc := Problem.Calculate(CalcSett);
VarReport := ProblCalc.CreateVariablesReport;
VarReport.AddVariableKind(MsVariableKind.Output);
DataSource := VarReport.CreateDataSource;
Ci := Mb.CreateCreateInfo;
Ci.ClassId := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
Ci.Parent := VarReport.ModelSpace As IMetabaseObjectDescriptor;
Ci.Name := Report by output variables;
Eax := Mb.CreateObject(Ci).Edit As IEaxAnalyzer;
Eax.CreateMultiOlap(DataSource);
VarReport.SetupSelection(Eax.Pivot.Selection);
(Eax As IMetabaseObject).Save;
s := (VarReport.Problem As IMetabaseObject).Name;
Debug.WriteLine(Report by output variables for problem + s + );
i := VarReport.ParamValues.Count;
Debug.WriteLine(Number of parameters in problem: + i.ToString);
Debug.WriteLine(Variables included into report:);
VarList := VarReport.Variables;
For i := 0 To VarList.Count - 1 Do
Varable := VarList.Item(i);
Debug.WriteLine(" " + Varable.Name);
End For;
b := VarReport.Parent <> Null;
Debug.WriteLine(There is parent object for virtual cube: " + b.ToString);
b := VarReport.Cube <> Null;
Debug.WriteLine(A virtual cube is created: + b.ToString);
End Sub UserProc;
After executing the example a report on variables for the PROBLEM problem will be created in the OBJ_MS modeling container. The report contains all data of all output variables. The names of variables included into the report and data of problem parameters are displayed in the console window.
See also: