Sending parameters from Visualize.js to Query on JasperReport Server

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 ------------------------------------------------------------------------------------------ */

    auth: {
        name: "jasperadmin",
        password: "jasperadmin",
        timezone: "Europe/Helsinki"
}, function (v) { 
    $(':disabled').prop('disabled', false);

    $("#selected_resource").change(function () {
        //add custom export format
        //(should throw a proper error)
        var reportExports =["json"]);

        report ={
            resource: $("#selected_resource").val(),
            container: "#container",
            params: {
            success: function () {
            error: function (error) {


    $("#exportButton").click(function () {        
            //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) {

    function createReport(uri) {        
                resource: uri,
                container: "#container",
                params: {
                error: function (err) {

}, 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(
    at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.appendParameterChunk(
    at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.appendQueryChunk(
    at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.parseQuery(
    at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.<init>(
    at com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRTimezoneJdbcQueryExecuter.<init>(
    at com.jaspersoft.commons.util.JSControlledJdbcQueryExecuter.<init>(
    at com.jaspersoft.commons.util.JSControlledJdbcQueryExecuterFactory.createQueryExecuter(
    at net.sf.jasperreports.engine.query.AbstractQueryExecuterFactory.createQueryExecuter(
    at com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRQueryExecuterAdapter.executeQuery(
    at com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRQueryExecuterAdapter.executeQuery(
    at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.executeQuery(
    at sun.reflect.GeneratedMethodAccessor1694.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(

/* ------------------------------------------------------------------------------------ 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

antonuccijulian's picture
Joined: Jul 4 2018 - 6:33pm
Last seen: 3 years 2 months ago

2 Answers:

When you deploy the report to jasper server you need to create or link the input control to the given report in jasperserver. 
Either you create the input control or if you have alreadt created it on the jasper server just browes the repository and select the alreadt created input control. 
The input control type is also imported. 
I would suggest to deploy the report on jasperserver, assign input control and then run the report as a user in jasper server and check if you can select and change the input control and ensure the report updates based on selections. 
Then you know your query and parameter combination on jrxml level is correct.

You know that the report deployment to jasperserver is correct. 
Then it just leaves your visualise.js implementation to check. 

joseng62's picture
Joined: Dec 5 2014 - 2:43am
Last seen: 1 month 3 weeks ago

How to deploy sub-report along with main-report . 



vinothm2k's picture
Joined: Dec 16 2018 - 11:20pm
Last seen: 3 years 10 months ago