Dynamically add new data source to report dictionary panel.

Stimulsoft Reports.ANGULAR discussion
Post Reply
aliriza
Posts: 1
Joined: Wed Mar 22, 2023 5:25 pm

Dynamically add new data source to report dictionary panel.

Post by aliriza »

I have an end-point that is returning a json data.

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;
                });
        }
    }
Summary, I want to add new dataSource to dictionary panel with keep already added ones. I appropriate to any suggestion.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Dynamically add new data source to report dictionary panel.

Post by Lech Kulikowski »

Hello,

Please send us a sample project that reproduces the issue for analysis.

Thank you.
Post Reply