A dashboard bound to a SQL data source can have its connection string and query rewritten from code in the onBeginProcessData event.

In React.
import { Viewer, Stimulsoft } from "stimulsoft-dashboards-js-react/viewer";

function App() {
    Stimulsoft.StiOptions.WebServer.url = "http://localhost:9615/";

    var report = new Stimulsoft.Report.StiReport();
    report.loadFile("Dashboards/SalesOfProducts.mrt");

    report.onBeginProcessData = function (args) {
        // Replace connection parameters or the SQL query before the request
        if (args.connection === "MySQL")
            args.connectionString = "Server=localhost; Database=northwind; UserId=root; Pwd=;";

        if (args.dataSource === "products")
            args.queryString = "SELECT * FROM MyTable";
    };

    return <Viewer report={report} />;
}

How it works. The event intercepts each data request, so connections and queries stay under server-side control.

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.