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

Working with a Sub Report and Groups at the same time 2

Status
Not open for further replies.

Mack2

Instructor
Mar 12, 2003
336
US
I have a report with a sub report. The sub report is brings over summed numbers. The main report has 3 groupings. Does the sub report require the same groupings in order to get the totals calculated correctly?
Hope this is enough info.
THANKS!!!!
 
If you place the subreport in the report header or footer, then it could cover all the data and ignore groupings in the main report.

If you want it 'per group', put it in the group header or footer and use Edit > Subreport Link to pass down the group value.

Note that each run of a subreport sends a fresh request for data to the server. Running it just once is more efficient.

You don't say just what the 'summed numbers' are. You can create summary totals or running totals for the whole report, shown in the reoprt footer. This would be more efficient, if your business need allows it.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thank you for your reply. I do want it "per group". But I want if for group #3. So do I only have to pass in the value for group #3 to the subreport and not the values of group 1 and group 2?

Does my subreport have to have the same grouping as group #3 in the main report?

Thanks again!
 
Your subreport does not have to have the same groupings or any groupings, but it must be linked by all three group fields.

-LB
 
Thanks!
When you say linked, do I also have to set the parameters equal to each other in the subreport? For example:
{Puchase.PurchasGroup} = {?Pm-?Purchasing Group}

Or do I just need to link them within the change import links menu?

Thanks!
 
If you mean report parameters, and you want them to apply to the subreport, then yes, you should link those also. Most of the time, you can select the parameter for the main report link and then it will automatically try to link to the corresponding field in the subreport (make sure it chooses the correct one). In the case of dates, where you might want a value to be > or <, after creating the link, go into the subreport record selection formula area and make sure the subreport date field is set up correctly in relation to the parameter value.

-LB
 
One more question. Do the linking fields need to be set to each other in the select expert of the sub report?

THANKS!
 
They should appear automatically as a result of the linking.

-LB
 
Thanks both of you for your help.
 
Do the reports have to be linked by the main reports grouped field? Because my subreport does not have a field to link to one of the grouped fields in the main report.
But I do not think the totals will come out correctly if the common fields are not linked.
Hopefully this makes sense.
THANKS!
 
You can make a link to a field of suitable data-type. This will add a selection statement to the subreport's record selection, Report > Selection Formulas > Record. But you can remove the selection criterion and still have the field available in the subreport

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Actually, you don't HAVE to link on every group, if the logic of the report doesn't dictate it. When you link, you should be thinking about what you want to appear each time the subreport is executed. Each link you add is like a record selection criterion that will narrow what appears in the subreport. If you have a groups on country, year, and store, and you wanted to show sales for the store in a particular country per year, you would link on all three groups, but if you wanted the subreport to show store sales for all years and all countries for a particular store (that may have multiple locations), then you would link only on store.

If you want more help, we will need to know what your groups are and what you are trying to show in the subreport, so that we can help you do the linking based on your particular logic.

-LB
 
That explanation was perfect!!! It answered my question perfectly.

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top