Data can be registered for a dashboard from code — here two buttons load XML or JSON and rebuild the report with it.

In Angular.
@Component({
    imports: [Viewer],
    template: `
        <button (click)="buttonXmlClick()">Register XML Data</button>
        <button (click)="buttonJsonClick()">Register JSON Data</button>
        <sti-viewer [report]="report"></sti-viewer>`
})
export class Example {
    report = Stimulsoft.Report.StiReport.createNewDashboard();

    updateReport(dataSet: Stimulsoft.System.Data.DataSet) {
        this.report = new Stimulsoft.Report.StiReport();
        this.report.loadFile("Dashboards/Orders.mrt");
        this.report.dictionary.databases.clear();
        this.report.regData("Orders", "Orders", dataSet);
    }

    buttonXmlClick() {
        var dataSet = new Stimulsoft.System.Data.DataSet();
        dataSet.readXmlSchemaFile("Data/Orders.xsd");
        dataSet.readXmlFile("Data/Orders.xml");
        this.updateReport(dataSet);
    }

    buttonJsonClick() {
        var dataSet = new Stimulsoft.System.Data.DataSet();
        dataSet.readJsonFile("Data/Orders.json");
        this.updateReport(dataSet);
    }
}

How it works. Each button loads a dataset and re-registers it, so the same dashboard renders from XML or JSON on demand.

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.