Jump to content

antonuccijulian

Members
  • Posts

    1
  • Joined

  • Last visited

antonuccijulian's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hi u all. I am new on using JasperReports Server. I found "Visualize.js" in order to connect my web app with the server but I got the next problem. I wanted to send some parameters from my web app (using Visualize.js) to a query, which helps me to fill the report with data from a table on my database. I tried like this... /* ------------------------------------------------------------------------------------------ CODE BELOW ------------------------------------------------------------------------------------------ */ visualize({ auth: { name: "jasperadmin", password: "jasperadmin", organization:"organization_1", timezone: "Europe/Helsinki" } }, function (v) { $(':disabled').prop('disabled', false); $("#selected_resource").change(function () { //add custom export format //(should throw a proper error) var reportExports = v.report.exportFormats.concat(["json"]); report = v.report({ resource: $("#selected_resource").val(), container: "#container", params: { nombre:["Julian"] }, success: function () { console.log(report.params()); }, error: function (error) { console.log(error); } }); }); $("#exportButton").click(function () { report.export({ //export options here outputFormat: $("#exportTo").val(), //exports all pages if not specified //pages: "1-2" }, function (link) { var url = link.href ? link.href : link; window.location.href = url; }, function (error) { console.log(error); }); }); function createReport(uri) { v("#container") .report({ resource: uri, container: "#container", params: { nombre:["Julian"] }, error: function (err) { alert(err.message); } }); }; }, function () { alert("Unexpected error!"); }); /* ------------------------------------------------------------------------------------------ END OF CODE ------------------------------------------------------------------------------------------ */ And respecting to JasperResports server, I have tried to fill my report with a query without parameters and It worked all right. select * from "TestTable" But when I try to add some parameters to filter the query It crash select * from "TestTable" where nombre = $P{nombre} and the log tell me something like this.... /* ------------------------------------------------------------------------------------ ERROR BELOW ------------------------------------------------------------------------------------ */ 2018-07-06 12:34:57,327 ERROR GenericExceptionMapper,http-nio-8081-exec-6:51 - Unexpected error occurs net.sf.jasperreports.engine.JRRuntimeException: Parameter "nombre" does not exist. at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.checkParameter(JRAbstractQueryExecuter.java:847) at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.appendParameterChunk(JRAbstractQueryExecuter.java:406) at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.appendQueryChunk(JRAbstractQueryExecuter.java:379) at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.parseQuery(JRAbstractQueryExecuter.java:359) at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.<init>(JRJdbcQueryExecuter.java:176) at com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRTimezoneJdbcQueryExecuter.<init>(JRTimezoneJdbcQueryExecuter.java:125) at com.jaspersoft.commons.util.JSControlledJdbcQueryExecuter.<init>(JSControlledJdbcQueryExecuter.java:63) at com.jaspersoft.commons.util.JSControlledJdbcQueryExecuterFactory.createQueryExecuter(JSControlledJdbcQueryExecuterFactory.java:24) at net.sf.jasperreports.engine.query.AbstractQueryExecuterFactory.createQueryExecuter(AbstractQueryExecuterFactory.java:49) at com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRQueryExecuterAdapter.executeQuery(JRQueryExecuterAdapter.java:131) at com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRQueryExecuterAdapter.executeQuery(JRQueryExecuterAdapter.java:108) at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.executeQuery(EngineServiceImpl.java:2348) at sun.reflect.GeneratedMethodAccessor1694.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) /* ------------------------------------------------------------------------------------ END OF ERROR ------------------------------------------------------------------------------------ */ I tried adding some Input Control but I really don't know how is the right way to do that. If someone can help me I would be very grateful. Thank you in advance. Shulian
×
×
  • Create New...