OpenMatrixDataSource(DataSource: IMatrixDataSource);
DataSource: An abstract multidimensional data source, data of which are to 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. Use the VariableStub property to access variables' data.
Executing the example requires a form, a button named Button1 positioned on this form, the UiErAnalyzer component named UiErAnalyzer1 and some components that show data of the express report loaded to UiErAnalyzer1. The repository is to contain a modeling container with the KONT_MODEL identifier. This container contains the modeling problem Problem_1 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 modeling problem Problem_1 is calculated. Report on the first output variable is loaded to the UiErAnalyzer1 component. Data are shown in all component using UiErAnalyzer1 as a data source.
See also: