we are trying to pass a custom data source (postgresql function) to a jasper report from servlet. the code in the servlet is as follows:
Map<String, Object> hm = new HashMap<String, Object>(); JRDataSource datasource = new PostgreSqlDatasource(conectionn, string1, string2, string3); hm.put("report_custom_DataSource", datasource );
we have a parameter named report_custom_DataSource in the jrxml report , which is of type jr datasource. but this approach is not passing the required datasource to the report , as a result the report is not rendering on the UI . Please let us know the correct way to pass a custom data source to a jasper report.
Some reference, http://community.jaspersoft.com/wiki/how-create-and-use-jrdatasource-adapter. And for the server, there used to be samples here, c:\jasperreports-server\samples\customDataSource\src\example\cds.
while this approach works , if we have hard coded values in the data source class, and the report renders fine with these values. the question is how to get values from a postgresql database function/procedure. we need certain parameters to be passed from the report to the function, so that data is generated dynamically.