I have a JasperReports template, and I need to pass some content not coming from a database query to Jasper parameters.
On my JasperTemplate I create the parameter, and I created the parameter too in Cuba Reports.
My code to call the report with params (found in forum) is:
public void onListarButtonClick() {
Map<String,Object> reportParams = new HashMap<>();
reportParams.put("fDesde", fechaDesde.getValue());
reportParams.put("fHasta", fechaHasta.getValue());
LoadContext<Report> lContext = new LoadContext<>(Report.class);
lContext.setQueryString("select r from report$Report r where r.name like '%Libro Diario%'");
Report report = dataService.load(lContext);
reportGuiManager.printReport(report,reportParams);
}
But on report $P{fDesde} is null. How can I pass a value from code to a CubaReport JasperTemplate?
I checked documentation, but is not explained very well how to work with Reports API from code (or I didn’t found it)