Registering Data from Code
Our sample projects and report templates can help you learn the basics of working with our products.A dashboard's data can be supplied from code: load the dashboard, clear its connections, and register your own dataset with regData.
Preparing the data. Read or create the data source, register it in the dashboard dictionary, synchronize the schema, and render with the supplied records.
Preparing the data. Read or create the data source, register it in the dashboard dictionary, synchronize the schema, and render with the supplied records.
import { Viewer, Stimulsoft } from 'stimulsoft-dashboards-js-react/viewer';
function App() {
var report = new Stimulsoft.Report.StiReport();
report.loadFile('Dashboards/Orders.mrt');
report.dictionary.databases.clear();
var dataSet = new Stimulsoft.System.Data.DataSet();
dataSet.readJsonFile('Data/Orders.json');
report.regData('Orders', 'Orders', dataSet);
return <Viewer report={report} />;
}