white_falcon02 Posted December 20, 2018 Share Posted December 20, 2018 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_numberFROM "emp_tbl" WHERE PROGRAM_ID = $P{Program_ID}[/code]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. Link to comment Share on other sites More sharing options...
Solution vchiem Posted December 21, 2018 Solution Share Posted December 21, 2018 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 buttonName = DEPT_IDExpression=$P{DEPT_ID}Sub report (employeesub1.jrxml)Query:select * from employee where department_id=$P{DEPT_ID}parameter defined:DEPT_IDI attached the jrxml files as well. Good luck. Link to comment Share on other sites More sharing options...
andycolman Posted December 21, 2018 Share Posted December 21, 2018 @vchiemHow would this work 1. using XML/XPath and 2. If the parameter is NOT for Prompting ? Link to comment Share on other sites More sharing options...
white_falcon02 Posted December 21, 2018 Author Share Posted December 21, 2018 Hi Andy,It is not for prompting. I have never explored working with xml/xpath or really know where to begin. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now