2018.1.2 How to add JSON data?
Posted: Mon Dec 11, 2017 5:21 pm
I recent upgraded my project from 2017.1 to 2018.1.2, and Im having trouble trying to add JSON data into my reports.
The old GetReportData method is gone and now we can create and access StiReport (thank you), but I cant figure out which methods to register data into my reports. I tried the following:
Before the report loads (before GetReportResult), I check the datasources of my report and my information is there. However, after the report is rendered, I get either error 500 (Internal Server Error) when using the Designer, or error 404 (Not Found) when using the Viewer.
I attached some sample data, but im not loading using a file. My objective is to load this data directly into the report, as shown in the code.
The old GetReportData method is gone and now we can create and access StiReport (thank you), but I cant figure out which methods to register data into my reports. I tried the following:
Code: Select all
var StiReport = new StiReport();
#region Layout
var relatorio = _repositorio.ObterLayout(formulario, sequencia);
StiReport.LoadFromJson(relatorio); //This loads my .mrt file, and is working as Intended
#endregion
StiDataCollection collection = new StiDataCollection();
#region Carrega Ambiente
var Ambiente = _ambienteRelatorio.ObterAmbienteRelatorio(empresaId: 1);
StiData _ambiente = new StiData("Ambiente", Ambiente); //Ambiente is a JSON object
collection.Add(_ambiente);
#endregion
StiReport.RegData(collection);
return StiNetCoreViewer.GetReportResult(this, StiReport);
I attached some sample data, but im not loading using a file. My objective is to load this data directly into the report, as shown in the code.