How to get parameter to subreport


Hi all,


I am desperate here. I am working in Studio 7.1. I have set up a parameter called Program_ID in the main report with a default value STRINGvalue of 'education' that I want to use as part of a WHERE clause in the subreport. I then added a new subreport with the following with use same report connection as main and add the following simple query: 


SELECT emp_number
FROM "emp_tbl" 

I added a parameter Program_ID to the subquery. I returned back to the main report and clicked on the subreport, edit parameters button, and set the expression to $P{Program_ID}. When I return to the subreport, it turn up zero results. If I hardcode the program_id as 'education' instead of $P{Program_ID}, I get back the full results that I am looking for.

I have tried everything I can thing of and would really appreciate any help one of you can give me.

white_falcon02's picture
Joined: Apr 1 2017 - 11:59am
Last seen: 1 year 3 months ago

Hi Andy,

It is not for prompting. I have never explored working with xml/xpath or really know where to begin.

white_falcon02 - 1 year 7 months ago

2 Answers:


It is important the wiring of the parameter/s between main and subreport is correct and this includes case sensitivity. 

Here is an example for a department main report with employee sub report using just one common parameter, DEPT_ID:

Main report 

Query :
select * from department where department_id=$P{DEPT_ID}

parameter defined:
DEPT_ID (Is For Prompting = true)

Subreport tab:

Expression = "employeesub1.jasper"
Connection Expression = $P{REPORT_CONNECTION}

Edit Parameters button
Name = DEPT_ID

Sub report (employeesub1.jrxml)

select * from employee where department_id=$P{DEPT_ID}

parameter defined:

I attached the jrxml files as well. Good luck.

Package icon examplesubreport.zip2.26 KB
vchiem's picture
Joined: May 1 2017 - 5:33pm
Last seen: 1 day 17 hours ago


How would this work 1. using XML/XPath and 2. If the parameter is NOT for Prompting ?

andycolman's picture
Joined: Jul 6 2018 - 2:50pm
Last seen: 1 year 4 months ago