Registering a Data for the Dashboard
Our sample projects and report templates can help you learn the basics of working with our products.In an ASP.NET Core MVC app the controller builds the dashboard and returns it to the viewer — here the data comes from a JSON file rather than the template.
Load the dashboard and register JSON data. In the
How it works. The dashboard is assembled server-side on each request, so its data can come from anywhere the controller can reach.
Load the dashboard and register JSON data. In the
GetReport action:var report = StiReport.CreateNewDashboard();
report.Load(StiNetCoreHelper.MapPath(this, "Dashboards/Dashboard.mrt"));
var jsonBytes = System.IO.File.ReadAllBytes(StiNetCoreHelper.MapPath(this, "Dashboards/Demo.json"));
var dataSet = StiJsonConnector.Get().GetDataSet(new StiJsonOptions(jsonBytes));
report.Dictionary.Databases.Clear();
report.RegData("Demo", "Demo", dataSet);
return StiNetCoreViewer.GetReportResult(this, report);StiJsonConnector.Get().GetDataSet(new StiJsonOptions(bytes))— parses JSON into aDataSet.Databases.Clear()+RegData(name, alias, data)— drop the template connections and bind the new data.StiNetCoreViewer.GetReportResult(this, report)— returns the prepared dashboard to the viewer component.
How it works. The dashboard is assembled server-side on each request, so its data can come from anywhere the controller can reach.