Search code examples
javajasper-reports

Passing a variable and query to Jasper report


Is it possible to pass both an SQL query, e.g. (<![CDATA[$P!{SQL}]]>), and a variable $V as parameters to a Jasper report at the same time?

Also, how can I pass the variable $V to my Jasper report using Java?


Solution

  • A variable is something that varies during the report generation, like the number of pages for example. So a variable ($V) is not something you can pass to a report. You may pass any value from your Java code to the report as a parameter ($P), though.