Deploy jasper reports in JasperReports Server using Parameters


This JasperReports Server tutorial will explain how to control input parameter in JasperReports Server. To control the inputs parameter we need to specify the parameters in JasperReports Server. This will give you the specific data in the reports.

Let’s start, follow the below steps to Add Input Control in JasperReports Server.

In this example we have added a parameterized report.

Step 1: Design your report with parameter and compile it and make sure there is no compilation error in the report. The query may be like

select * from tbl_test where id=$P{id}

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.

Deploy jasper reports in JasperReports Server using Parameters

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

Deploy jasper reports in JasperReports Server using Parameters

Step 5: After filling the details, click on the Controls & Resources tab » Add Input Control….

Deploy jasper reports in JasperReports Server using Parameters

Step 6: Locate your Input Control

Deploy jasper reports in JasperReports Server using Parameters

Step 7: Create your Input Control… In this section define the Type of parameter whether it is a single value or multiple values.

Make sure Parameter Name must be same that defined in the report.

Deploy jasper reports in JasperReports Server using Parameters

Step 8: Define the Datatype of the parameter.

Deploy jasper reports in JasperReports Server using Parameters

Step 9: Now click on the Data Source tab » Select data source from repository » Browse and select the data source.

Deploy jasper reports in JasperReports Server using Parameters

Step 10: Finally hit the Submit button then run your report. When you will run your report it will ask the parameter.

Deploy jasper reports in JasperReports Server using Parameters

Step 11: Here is the output according to the parameter.

Deploy jasper reports in JasperReports Server using Parameters

Step 12: Done. Thank You:)


Similar Posts

About the Author

Websparrow
I like sharing my experiments and ideas with everyone by writing articles on the latest technological trends.