OpenMatrixDataSource(DataSource: IMatrixDataSource);
DataSource - an abstract multidimensional data source, which data should be loaded to the express report.
The OpenMatrixDataSource property loads data to the express report from a non-cube source.
For example, data of modeling variables obtained as a result of a modeling problem calculation can be used as a non-cube source. Access to data variables is executed by means of the VariableStub property.
Executing the example requires a form, a button named Button1 on the form, the UiErAnalyzer component named UiErAnalyzer1 and some components that show data of the express report loaded to UiErAnalyzer1. The repository should contain a modeling container with the KONT_MODEL identifier. This container contains the Problem_1 modeling problem configured to calculate models.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
Expr: IEaxAnalyzer;
Problem: IMsProblem;
Setting: IMsProblemCalculationSettings;
Calc: IMsProblemCalculation;
MDS: IMatrixDataSource;
Begin
//Temporary express report
MB := MetabaseClass.Active;
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
Expr := MB.CreateObject(CrInfo).Edit As IEaxAnalyzer;
//Calculated modeling problem
Problem := MB.ItemByIdNamespace("Problem_1", MB.ItemById("KONT_MODEL").Key).Bind As IMsProblem;
Setting := Problem.CreateCalculationSettings;
//Calculate modeling problem
Calc := Problem.Calculate(Setting);
//Data on the first output variable
MDS := Calc.VariableStub(Problem.VariableStubs(MsVariableKind.Output).Item(0));
//Load to express report
Expr.OpenMatrixDataSource(MDS);
//Load express report to "UiErAnalyzer1"
UiErAnalyzer1.ErAnalyzer := Expr;
UiErAnalyzer1.Active := True;
End Sub Button1OnClick;
After executing the example the Problem_1 modeling problem is calculated. Report on the first output variable is loaded to the UiErAnalyzer1 component. Data is displayed in all components using UiErAnalyzer1 as a data source.
See also: