Using Parameters in SQL Query
Our sample projects and report templates can help you learn the basics of working with our products.SQL query parameters can be set from code in the
In Angular.
How it works. The parameter is applied before the SQL runs, so filters stay on the server side.
onBeginProcessData event before the data request runs.In Angular.
import { Component } from "@angular/core";
import { Viewer, Stimulsoft } from "stimulsoft-dashboards-js-angular/viewer";
@Component({
imports: [Viewer],
template: `<sti-viewer [report]="report"></sti-viewer>`
})
export class Example {
report: Stimulsoft.Report.StiReport;
constructor() {
Stimulsoft.StiOptions.WebServer.url = "http://localhost:9615/";
this.report = new Stimulsoft.Report.StiReport();
this.report.loadFile("Dashboards/SalesOfProducts.mrt");
this.report.onBeginProcessData = function (args) {
// Change SQL query parameters before the request
if (args.dataSource === "products") {
args.parameters[0].value = "8";
}
};
}
}StiOptions.WebServer.url— points the engine at the Node.js SQL adapter service.args.parameters[0].value— set the query parameter server-side; the change is not exposed to the client.
How it works. The parameter is applied before the SQL runs, so filters stay on the server side.