Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subreport filtering data even when no parameter provided from main

Status
Not open for further replies.

elsenorjose

Technical User
Oct 29, 2003
684
US
I have a report that has a subreport linked on a few fields; some dates, an Issue Type, and an Org Unit. When I run the report with no Org Unit selected, the subreport somehow still filters the report based on an Org Unit even though I’m not passing it down as a parameter. It doesn’t appear to be arbitrary, though; it looks to be taking the first Org Unit from the details of the main report. The subreport is in GH1. Anyone ever run across something like that?

Thanks.

CR XI R2, SQL Server 2005
 
Hi,
The subreport in the header will filter on the first record in the detail for that group - no parameter needs to be passed, the link handles that.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
How can I prevent it from doing that? I want to see all the records from the main in the sub; the sub has some additional information that we can't get in the main so this filtering is not welcome :)

Thanks Turkbear.
 
Hi,
try placing the sub in GF1 ( I can't test but that may get you all the records since it comes after the details run).



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Nope. Now it displays the data based on the LAST Org Unit in the main :)
 
Hi,
OK, I was afraid that might happen..As long as the sub is linked to a field that is in a group section, you are likely to get only 1 value for it.

How is your report structured ( Groups., details. etc)

Does the sub need to be in a GH or GF or could it be in a second detail?



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
It sounds like you are using a parameter for Org Unit. You should then be creating the same parameter in the subreport, adding selection criteria in the sub record selection area, and then linking the main report parameter to the subreport parameter by by using the dropdown in the lower left to select {?unit}, not the default {?pm-?unit}.

-LB
 
Hi LB,

Would this be the case for ALL parameters? I knew I had to do that to dates, but should I also do it for the Issue Type parameter as well as Org Unit?

Thanks.
 
It still happens even after setting up the parameter that way.


Turkbear, both reports have only one group, Issue Type. Unfortunately the users DO want the sub first. I've even tried moving it to a page header or report header but that filtering behavior continues. I'm going to delete the sub and start from scratch.
 
If you only have one group and the sub is placed in the group header, then you should only be linking on the group field. Then the question becomes whether you are using parameters in the main report to filter records that you also want filtered in the sub. If so, then link the parameters to each other and reference the parms in the selection formula in the sub.

Think of it this way--subreport links generally require the linking field to exactly match the corresponding field in the main report. If you only want the same general filtering in the sub, then you would link the parms to each other instead.

-LB
 
Thanks, I spotted that error. I was linking one of the parameters in the sub to the actual field in the main, not the same parameter. It looks like it's working now.

Thank you both.
 
Yep, that did it. If I could bother you once more regarding formatting. Since I have the subreport in a group header, it's printing whenever the groups change in the main report. Is it possible to suppress the subreport so that it only prints once at the beginning of the report? I tried putting it in the page header but I got an error saying the page wasn't big enough to accommodate it.

Thank you.
 
Thanks. This report has been giving me fits. That did it. Now if I can just figure out how to fake a page footer in the sub. There's a 'Company Confidential' statement in every page footer in the main report but when I put the sub in the RH, no page footer prints until the first page of the main.
 
In the main report, create a formula {@all}:

whilereadingrecords;
""

Insert a group on this formula and make it your group #1. Then move the subreport into this. You now will have the main report page footer available to you.

Also note that if you are removing the sub from the group header, then you should not be linking on the group field, since when you move it to the {@All} header, it will only respond based on the first instance of the group field. Again, this may be a case where you want to use a parameter to limit the range of records to those reflected in the main report, i.e., you may want to link parameters again.

-LB
 
Thanks LB. I had already linked the report on parameters only so the data is being retrieved correctly AND I have the page footer back. Thanks for your help :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top