Dynamically add new data source to report dictionary panel.
Posted: Wed Mar 22, 2023 5:34 pm
I have an end-point that is returning a json data.
Here is the angular code:
Summary, I want to add new dataSource to dictionary panel with keep already added ones. I appropriate to any suggestion.
Here is the angular code:
Code: Select all
onConnectorsGridModalClosed(selectedConnector: any) {
this.isConnectorsGridModalOpen = false;
this.selectedConnector = selectedConnector;
if (this.selectedConnector) {
this.reportService.getData(this.selectedConnector.id) // this end-point is returning a json data
.subscribe((result) => {
let dataSet = new Stimulsoft.System.Data.DataSet(this.selectedConnector.name);
dataSet.readJson(result);
// this is adding the dataSource, I can see it in this.designer.report.dictionary.dataSources and it is calling back-end as we expected.
this.designer.report.regData(this.selectedConnector.name, this.selectedConnector.name, dataSet);
this.designer.report.dictionary.synchronize();
// following lines are working. I can see the newly added datasource in dictionary panel. But everytime, it is adding latest selected, and removing already exists.
// let report = new Stimulsoft.Report.StiReport();
//
// report.regData(this.selectedConnector.name, this.selectedConnector.name, dataSet);
// report.dictionary.synchronize();
// this.designer.report = report;
});
}
}