jkeri Posted October 8, 2018 Share Posted October 8, 2018 I have report that contains a subreport. Each one has its own data set/SQL query.The sql for my main report has two record types., 'ACCOUNT', and 'DTL'. there is one record for each 'ACCOUNT and multiple records for 'MAIN'.What I want to do is for each 'ACCOUNT' record to execute the sub report query.I need to pass the ACCOUNT.account_number to the subreport account_number query.How can i do this? Link to comment Share on other sites More sharing options...
joseng62 Posted October 8, 2018 Share Posted October 8, 2018 So in the subreport you need to create a parameter that is going to hold the value passed over from the main account. So if Account filed in main is integer, then create corresponding parameter. Let say AccountSubRpt. In main report select sub report, then in property tab, select Subreport tab, then there will be a "Edit Parameter" button, use that. So in parameter name type in AccountSubRpt. and then in the parameter Expression select your Account field. So this creates mapping link between the main and sub. This will pass over the parameter. You need to do a couple of other things. 1) Do not add the sub report in the detialed band. its going to duplicate the report subreport mutiple times. Rather create a dummy group, leaving the expression for the group blank, then you can add the sub report in the dummygroupheader section. 2) You need to add $P{AccountSubRpt} to your sub report sql query. That sohuld be it. Link to comment Share on other sites More sharing options...
jkeri Posted October 9, 2018 Author Share Posted October 9, 2018 excellent!!! it works exactly as you described. 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