Using a Custom Data Adapter
Our sample projects and report templates can help you learn the basics of working with our products.For a data source the engine does not support natively, you can register a custom database that answers its data commands yourself.
In React.
How it works. The engine talks to your adapter through the same command protocol as built-in databases, so any JavaScript-queryable source becomes a dashboard data source.
In React.
import { Designer, Stimulsoft } from "stimulsoft-dashboards-js-react/designer";
function App() {
Stimulsoft.Report.Dictionary.StiCustomDatabase.registerCustomDatabase({
serviceName: "MyDatabase",
process: function (command, callback) {
if (command.command === "TestConnection") callback({ success: true });
if (command.command === "RetrieveSchema") callback({ success: true, data: demoData, types: demoDataTypes });
if (command.command === "RetrieveData") callback({ success: true, data: demoData[command.queryString] });
}
});
var report = new Stimulsoft.Report.StiReport();
report.loadFile("Dashboards/CustomAdapter.mrt");
var options = new Stimulsoft.Designer.StiDesignerOptions();
options.appearance.fullScreenMode = true;
return <Designer options={options} report={report} />;
}registerCustomDatabase({ serviceName, process })— plugs a bespoke source into the dictionary.- The
processcallback answersTestConnection,RetrieveSchemaandRetrieveDatawith your own data.
How it works. The engine talks to your adapter through the same command protocol as built-in databases, so any JavaScript-queryable source becomes a dashboard data source.