Using Viewer Parameters
Our sample projects and report templates can help you learn the basics of working with our products.The viewer can be driven from your application through a properties object — for instance to switch which dashboard is shown at run time.
Read the properties and load the chosen dashboard.
How it works. The Angular component passes properties with each request, so the controller can vary the dashboard it returns without new endpoints.
Read the properties and load the chosen dashboard.
public IActionResult GetReport()
{
var reportName = "HotelRevenue.mrt";
var httpContext = new Stimulsoft.System.Web.HttpContext(this.HttpContext);
var properties = httpContext.Request.Params["properties"]?.ToString();
if (properties != null)
{
// parse the JSON properties passed from Angular to pick the dashboard
}
var report = StiReport.CreateNewReport();
report.Load(StiAngularHelper.MapPath(this, $"Reports/{reportName}"));
return StiAngularViewer.GetReportResult(this, report);
}Request.Params["properties"]— a JSON payload the Angular app sends to parameterize the viewer.- Use it to choose the dashboard file (or other settings) so the same viewer serves different content on demand.
How it works. The Angular component passes properties with each request, so the controller can vary the dashboard it returns without new endpoints.