setDataSources(analyzer: PP.Exp.EaxAnalyzer, arrSources: Array, openParams: Array, openOptions: PP.Exp.EaxDataSourceOpenMode, callback: PP.Delegate, fireEvent: Boolean, errCallback: PP.Delegate);
analyzer. Express report, for which the user defined data source.
arrSources. Array of metabase objects or their keys.
openParams. Hash array of parameters, with which it is required to open data source.
openOptions. Sets cube extraction mode: with a saved view (default), or data only.
callback. Callback function.
fireEvent. Indicates if the EaxMdService.MdLoaded event occurs. Available Values:
true. On performing the method the EaxMdService.MdLoaded event occurs.
false. On performing the method this event is not fired.
errCallback. Callback function on error.
The setDataSources method sets data source for cube.
Executing the example requires that the HTML page contains the ExpressBox component named expressBox (see Example of Creating the ExpressBox Component). The repository must also contain a time series database or cube with the OBJ_TS_DB identifier, that will be set as the express report data source in the following example:
// Get a service used to work with express report var eaxMdService = expressBox._Service; //Handle the MdLoaded event eaxMdService.MdLoaded.add(function (sender, args) { if (args) { console.log("The "%s" express report is loaded", args.Source.getName()); } }); // Get express report document var eaxAnalyzer = expressBox.getSource(); // Create a key of metabase object that is data source var source = new PP.Mb.Object({ Id: "OBJ_TS_DB" }); source.setOdId("567854567896556"); // Determine callback function parameter var dsArgs = new PP.Mb.Ui.PropertyChangedEventArgs({ PropertyName: PP.Exp.Ui.ControlType.DataSources, Metadata: { Keys: [source] }, TypeUpdateData: [PP.Exp.Ui.ViewTypeUpdate.DataView, PP.Exp.Ui.ViewTypeUpdate.Ribbon] }); // Determine callback function var onSetDataSources = function (sender, args) { // Refresh express report expressBox.refreshAll(); }; // Determine function for handling error on setting a new data source var onErrCallback = function (sender, args) { console.log("Error on setting a new data source"); }; // Set a new data source for cube eaxMdService.setDataSources(eaxAnalyzer, [source], null, PP.Exp.EaxDataSourceOpenMode.None, PP.Delegate(onSetDataSources, this, dsArgs), True, PP.Delegate(onErrCallback, this));
After executing the example a data source with the OBJ_TS_DB identifier is set for the current express report. The browser console displays name of the loaded express report:
The Comparison of Gross Regional Product by Regions express report is loaded