How to define query in JasperReports Server


In this example, we are going to explain how to define the query in JasperReports Server. Most of the time we put all the query in .jrxml file but here we can also define the query in the JasperReports Server.

Defining the query in JasperReports Server is totally independent of report query. You can manage it anytime and modified it according to need.

Check the below steps to define the query.

Note: Do not add the query in .jrxml file.

Step 1: Design your report, compile it and make sure there is no compilation error in the report.

Step 2: Click on the View » Repository and expand the root folder, select Reports folder.

Step 3: Right-click on the Reports folder and go to Add Resource » JasperReports .

How to define query in JasperReports Server

Step 4: A new page will open, fill the required details and browse the report .jrxml file.

How to define query in JasperReports Server

Step 5: After filling the details, click on the Query tab » Click here to create new Query.

How to define query in JasperReports Server

Step 6: Fill out the name of your Query and click on Next button.

How to define query in JasperReports Server

Step 7: Link the Data Source to the Query.

How to define query in JasperReports Server

Step 8: Select the query language and define the Query.

How to define query in JasperReports Server

Step 9: Click on the Save » Submit button and run the report.

Step 10: Done. Thank You


Similar Posts

About the Author

Atul Rai
I love sharing my experiments and ideas with everyone by writing articles on the latest technological trends. Read all published posts by Atul Rai.