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

How to create a report with one Master and two Details ?

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
How can I create a report that has one Header table and two Details ?
For example I might have three tables, StockCode, SalesLine and BuyLine.
Ideally I'd like to be able to create a report that lists each stock code (from StockCode table) and then after each, lists first the appropriate SalesLine entries (for that stock code) and then the BuyLine entries (for that stock code).

For instance I'd like to have something like :

StkCode1
- SalesLine1 (for StkCode1)
- SalesLine2 (for StkCode1)
- BuyLine1 (for StkCode1)
- BuyLine2 (for StkCode1)
- BuyLine3 (for StkCode1)
StkCode2
- SalesLine1 (for StkCode2)
- SalesLine2 (for StkCode2)
- SalesLine3 (for StkCode2)
- BuyLine1 (for StkCode2)
StkCode3
- SalesLine1 (for StkCode3)
- BuyLine1 (for StkCode3)
- BuyLine2 (for StkCode3)

I seem to have drawn a blank (hitting a dead end) trying to generate a report like this.
After adding the three tables StockCode, SalesLine + BuyLine I created links between StockCode - SalesLine (through StkCode field) and StockCode - BuyLine (through StkCode field). I then had three Detail bands, the first one for StockCode, the second for SalesLine, the third for BuyLine (supressing blanks for Detail bands 2 + 3).
This almost gives me what I want but if using the data as above actually gives me the following :

StkCode1
- SalesLine1 (for StkCode1)
- BuyLine1 (for StkCode1)
StkCode1
- SalesLine2 (for StkCode1)
- BuyLine2 (for StkCode1)
StkCode1
- BuyLine3 (for StkCode1)
StkCode2
- SalesLine1 (for StkCode2)
- BuyLine1 (for StkCode2)
StkCode2
- SalesLine2 (for StkCode2)
StkCode2
- SalesLine3 (for StkCode2)
StkCode3
- SalesLine1 (for StkCode3)
- BuyLine1 (for StkCode3)
StkCode3
- BuyLine2 (for StkCode3)

Can anyone suggest how I can get the layout in the way as indicated in the first instance ?
I don't know if it's not achievable or if its just a case of not being able to see the wood for the trees ? :)

[I am developing the Crystal Report against Paradox tables.]

Any help / pointers would be greatly appreciated.

Thanks in advance.
Steve
 
I think that you want to use a subreport to demonstrate the Buylines.

So the main report has:

GH1 StkCode
GH2 SalesLine
details <suppressed>
GH2 <suppressed>
GF1 <subreport with just the BuyLine table with the link to the Stockcode.stkcode field>

So you'd get all of the Stkcodes and the SalesLines in the main report in the proper order, and then all of the Buylines in the subreport.

It'll decrease performance, but it'll work.

-k kai@informeddatadecisions.com
 
Can I create a link from a table field in the main report to a table field in the subreport ?
If so, how ?
Thanks again
Steve
 
From the main report choose
EDIT --> Sub Report Links
and i t should be self expainatary from there. The day He summons you, you will respond by praising Him, and you will then realize that you had lasted in this life but a short while.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top