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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formulate a list of values to pass on to Sub-report 1

Status
Not open for further replies.

kj27

Programmer
Mar 16, 2010
30
US
I'm probably missing something obvious.
My main report selects: department, location, userID, etc and groups on location. Within each location there are multiple UserID's. What I'd like to do is pass my sub-report parameter a list of all the UserID's so that for each grouped location I can let that sub-report's selection do an in filter.

i.e. Main Report: location_var:= "1,2,3"
Sub-report selection: "{User.UserID} in {?location_var}

The problem is that currently, the location_var holds just the first UserID.

Thanks
 
So the sub is in a location group section? How are you selecting User IDs in the main report? Are you using a parameter for User ID or do you mean you just want the same User IDs in your sub as fall under each location in the main report? You could add a group on user ID in the main report, move the sub there, and then link on both location and user ID--depending upon what you are trying to do in the sub.

-LB
 
Hi LB,

The sub is in the group header. The selection for the main report is on the record level based on department and a few other criteria. But the User ID is just part of the normal select process. (i.e. Select Field1, 2, UserID, Field4 from table where...)

I have set up a parameter for UserID in the Subreport and was trying to pass the UserID's selected in the main report to pass into the sub. The sub would then do counts on other tables based on the UserId's passed in (i.e. select count(historyentries) from table where UserID in(...)

Thanks
 
There are various ways you can show only the same IDs in the subreport through suppression using a shared variable, but I can't think of a way you could select only the desired IDs--unless you use the same selection criteria as in the main report, instead of trying to pass the IDs from main to sub. If this is an option, then I think you should do that, since suppression will make your summaries in the subreport complex.

-LB
 
The idea to use the same queries in the subs is a good one. But to be simpler, what we get from the subs are counts (totals) per user.

Is there a way to simply take those subreport counts and total them per group to display on the main report? I mean I can just supress the sub-reports so they don't show per-user details.

Thanks a bunch.
 
I'm not sure what you are asking. You can set the group totals from the subs to a shared variable that is then displayed in the main report. You can't suppress the sub outright, but there is a way to make it disappear.

-LB
 
That'd be perfect - the ability to get a group total to display back to the main report.

Right now, I'm using shared variables between the sub and main that get totals for all the groups. But these are essentially running totals. I'd like to print per group and then "reset".

Thanks.
 
Isn't the subreport linked on the groupfield? If you are sharing a group total from the subreport to the same group in the main report, then you just need to set up a formula in the subeport:

whileprintingrecords;
shared numbervar grptot := sum({table.amt});

Then in a section below the one containing the sub on the main report, use:

whileprintingrecords;
shared numbervar grptot;

If the sub can be null, then add a reset formula in the section after the one containing the displayed value:

whileprintingrecords;
shared numbervar grptot := 0;

-LB
 
That was the problem. The sub was linked on the incorrect group. By re-linking to the correct level, I was able to filter out the initial set of records. This was exactly what was needed - rather than doing the filtering separately within the sub itself. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top