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

Two details in a report, without using subreports

Status
Not open for further replies.

ndaru

Programmer
Oct 23, 2001
26
ID
Just curious,

Is it possible to put two details (from two tables) in a report, without using subreports?

 
Not usually. Describe the data a bit more. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Right click on the details tab and select insert detail line. Is this what you were looking for ?
 
These are the data structures:

Table Master:
- Master_ID
- Field_1
- Field_2

Table Detail_A:
- Master_ID
- Detail_A_ID
- Field_1
- Field_2

Table Detail_B:
- Master_ID
- Detail_B_ID
- Field_1
- Field_2

The desired result is:

<PRE>
Master: (on report header)

Detail_A:
Field_1 Field_2
------- -------
xxxxxxx xxxxxxx
xxxxxxx xxxxxxx
xxxxxxx xxxxxxx
xxxxxxx xxxxxxx

Detail_B:
Field_1 Field_2
------- -------
xxxxxxx xxxxxxx
xxxxxxx xxxxxxx
xxxxxxx xxxxxxx
xxxxxxx xxxxxxx

</PRE>

As far I know, these can be achieved using subreports. Is
there any other way around? I'm asking this because someone
told me that we can't create nested subreports using Crystal
Reports.
 
You have 2 &quot;one-to-many' relationships, so linking them directly is going to create inflation.

Do you need to do any totals, or just list the details?
Will there always be at least one record from both tables? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
I'd do the main report using Master and DetailA, and then do DetialB in a subreport. This is exactly what they were designed to do.

I'm not sure what you are saying about &quot;nested subreports&quot;. There is usually a solution to be found where they won't be needed. Editor and Publisher of Crystal Clear
 
Ken: I only need to list the details and yes, there should be at least one record from each detail.

chelseatech, I'd already done that and it worked. I also have many other reports that include subreports to solve this kind of situation.

But now the client wants me to compile all of those separate reports into a single report. I'd already think about creating one main report and inserting all of the other reports as subreports. Like this:

Main_Report.rpt:

<subreport from Report_1.rpt>
<subreport from Report_2.rpt>
<subreport from Report_3.rpt>
...
...
...
<subreport from Report_n.rpt>

While all reports from Report_1.rpt to Report_n.rpt use subreports. I have created the Main_Report.rpt and inserted Report_1.rpt as subreports. It worked fine, except that the subreports of Report_1.rpt (i.e: the nested subreports) did not show up -- just blank.

Thanks.

 
One option is to make this report into 2 separate subreports when you instert it. But, if this report is GROUPED on the Master ID, this won't work.

You could also link the tables together (which will cause duplication) and add 2 cross-tabs (to eliminate the duplication). This won't work in all situations but is worth exploring. One way would be to use Detail field 1 as the row, and a maximum of field 2 as the summarized Field in each cross-tab. This allows you to do 2 different groupings, simultaneously - as long as you aren't trying to get accurate totals. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top