Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Using multiple subreports in one report Post Reply Post New Topic
Author Message
gloworm
Groupie
Groupie


Joined: 10 Oct 2011
Online Status: Offline
Posts: 47
Quote gloworm Replybullet Topic: Using multiple subreports in one report
    Posted: 08 Jan 2013 at 11:46am
http://i712.photobucket.com/albums/ww125/thegloworm901/PARTS_zpsc839089a.jpgI am creating a report that will consist of data from 3 queries.

My thought is to create a report that contains the results of each query in its own subreport.

The first query/subreport will pull part number information which is one row of data.

Second query/subreport pulls the possible vendors for the part number in query one.  Can be multiple rows.

Third query/subreport pulls open purchase orders for the part number in query one.


I then have to figure out a way that for each part number in query one, I stagger the correct vendor and open order information in the same section before it has the next part number.

I have attached an example spreadsheet that was given to me to work off of.  As you can see, there is one part number in the first section.  You can see the multiple entries in sections 2 and 3.

That is what I need to recreate in Crystal.


Edited by gloworm - 08 Jan 2013 at 11:52am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 09 Jan 2013 at 6:55am
so why not have the 3 reports.
1 main report which is the part number, then the subreports for each part number.
IP IP Logged
gloworm
Groupie
Groupie


Joined: 10 Oct 2011
Online Status: Offline
Posts: 47
Quote gloworm Replybullet Posted: 09 Jan 2013 at 7:36am
My issue comes from the spacing of the data which is dynamic.  Report 1 will always have 1 record.  If report 2 varies from 1 row to 30 rows, how can I tell report3 to start where ever report2 leaves off? 

For example:  1 row in section 1, 3 rows in section 2, means section 3 will start on row 5.

But if section 2 has 20 rows, then section 3 should start on row 22.

That example is what I will be running into.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 09 Jan 2013 at 11:24am
so you're numbering the rows?
 
if so, just use a shared variable that is reset to 1 for every part number.
 
shared numbervar rowCounter;//declaration
rowCounter := rowCounter + 1;//incrementing
rowCounter;  //display resutls
 
you can use any combination of the above, as long as you always use the first row...you need to tell CR that you are using the shared variable, after that everything is automagical.
 
HTH
 
IP IP Logged
gloworm
Groupie
Groupie


Joined: 10 Oct 2011
Online Status: Offline
Posts: 47
Quote gloworm Replybullet Posted: 09 Jan 2013 at 11:27am
I am not numbering the rows.  I used numbers to show how many spaces the next report had to move down to make it look like it was flowing through the data.  The number of total rows, per part number, is going to change with every new part number in the report.


IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 09 Jan 2013 at 11:38am
then this would presume that you couldn't just so the simple
main groupheader1a:partnumber
main groupheader1b:subreport1
main groupheader1c:subreport2
 
it would appear that all the data is all in one report, it's all in how you layout your subreports.  It would appear that you can just let CR do that sort of work.
 
HTH
IP IP Logged
gloworm
Groupie
Groupie


Joined: 10 Oct 2011
Online Status: Offline
Posts: 47
Quote gloworm Replybullet Posted: 09 Jan 2013 at 11:50am
I see what you are saying. 

I have been thinking I may have made this too complicated.  I was going on the premise of taking the 3 queries and making 3 subreports.

As long as I can get the tables to relate, I can/should do this in a single report.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 10 Jan 2013 at 6:28am
well, you can't really have just 3 subreports...they are subreports to some main report, and that main report is going to be the driver. The natural candidate is the part number, since it is at the root/top of the hierarchy. 
 
The part number calls the other 2 subreports (this way you don't have to worry about having to change the queries), and you just need to display their output. Since you get to control the order and placement in design time, they should layout just as you want
 
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.