Creating a new Data Connection from code
Our sample projects and report templates can help you learn the basics of working with our products.A data connection can be built from code and added to the dashboard's dictionary, replacing whatever the template carried.
In React.
How it works. The dashboard resolves its elements against the code-built connection, so its data source is defined entirely in code.
In React.
import { Viewer, Stimulsoft } from "stimulsoft-dashboards-js-react/viewer";
function App() {
var report = new Stimulsoft.Report.StiReport();
report.loadFile("Dashboards/Orders.mrt");
report.dictionary.clear();
var database = new Stimulsoft.Report.Dictionary.StiJsonDatabase("Orders", "Data/Orders.json");
report.dictionary.databases.add(database);
report.dictionary.synchronize();
return <Viewer report={report} />;
}StiJsonDatabase(name, path)— a JSON connection created in code.dictionary.databases.add(db)+dictionary.synchronize()— register it and generate matching fields.
How it works. The dashboard resolves its elements against the code-built connection, so its data source is defined entirely in code.