Creating a new Data Connection from code
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.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.