aspose file tools
The moose likes Other Open Source Projects and the fly likes JasperReport : Dynamic SQL Query to inside <queryString> Tag of jrxml file  Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "JasperReport : Dynamic SQL Query to inside <queryString> Tag of jrxml file  " Watch "JasperReport : Dynamic SQL Query to inside <queryString> Tag of jrxml file  " New topic
Author

JasperReport : Dynamic SQL Query to inside <queryString> Tag of jrxml file

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

The below is part of my sample MyReport.Jrxml File .
Here as you can see the sql query is static .




How can i make it dynamic , so that i want to pass this value dynamically from my Java Program .
Please guide me .
Please tell me what should be appended inside the queryString Tag so to make it dynamic ??

Thanks .


Save India From Corruption - Anna Hazare.
bikashmca kr
Greenhorn

Joined: Feb 04, 2011
Posts: 1
You can use parameter for this purpose, like for ACTUAL_DATE, following is the syntax.

in sql query you can write, you need to create input control in the jasperserver also while uploading this jrxml.

where date = $P{ACTUAL_DATE}

<parameter name="ACTUAL_DATE" class="java.util.Date">
<defaultValueExpression><![CDATA[(new java.util.Date())]]></defaultValueExpression>
</parameter>

<parameter name="STRING_PARAMETER" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
guntur reddy
Greenhorn

Joined: Jan 23, 2011
Posts: 9
se this example it is usefull

The only change we need to make on the JRXML template is to remove the <queryString> element.
To fill the report, we need to execute a database query in our Java code, and pass the query results to the report in a datasource, as can be seen in the following example:



I think it is useful

Thanks
venu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JasperReport : Dynamic SQL Query to inside <queryString> Tag of jrxml file
 
Similar Threads
Dynamically setting schema name for native queries in hbm file
jasper Reports
Dynamically setting schema name for native queries
[RESOLVED] jasper & iReport multi-reports