Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Linked Subreport??? Post Reply Post New Topic
Author Message
pgiering
Newbie
Newbie


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 37
Quote pgiering Replybullet Topic: Linked Subreport???
     Posted: 20 Nov 2009 at 11:26am
Hi, I am using CR 10, and I think what I need to do is to use the results of a subreport to act as parameters in my main report, although I am open to suggestions if you see a better way to do this.
 
I am building product recall report, so that if we identify a batch of unsuitable raw materials, which have already been used in a work order, we can tell what those order numbers were.
 
I have a report that does this already, it is a simple query of BatchNo, which then tells me all the OrderNo's that were pulled from that batch. 
 
What I am now trying to do is to go one step beyond that and identify whether any of the product resulting from those workorders was then used to make an even higher level assembly, and so on. 
 
What I run the report I will always know the original "bad" BatchNo, and I can rely that the workorder "OrderNo" will always become the BatchNo of the resulting product.  So I want to run a subreport whereby I enter the original "bad" BatchNo, and generate workorder "OrderNo's" which will then be delivered to the main report, which will run the same query using those "OrderNo's" as the next level "BatchNo's".
 
Right now, I am trying to get this to work for one level (One subreport feeding into the main report, to get two capture two levels of product to recall).  Ultimately, I am hopeing to figure out how to run the query one time and have it repeat until there are no more workorder "OrderNo's" being output, which would mean that the query had reached the last level of unusable product.
 
I have used subreports before, but I only know how to make a single value available for use in a main report, for instance a collumn total.  But I don't know how to make every value in that collumn available.
 
Any suggestions for making the entire column available to be used as a parameter in the main query, or for making the process repeat untill all workorders have been identified (without having to manually relaunch the query)?
 
Thanks,
 
Paul
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 23 Nov 2009 at 6:59am
ultimately, won't work...CR only does 1 level of subreports, so you cannot have your subreport call itself ad infinitum until all done.  Also, it would be very hard to return all the columns and rows from a subreport to the main report (it's doable using shared xxxxxvar array) but the main report will not call another subreport based on those (at least I am very doubt, and if it does, the report is beginning to get hopelessly complex)
 
A better solution, though perhaps just as convoluted, is to use a stored procedure.  Here you can define the parent and it's subassembly and then track it that way.  I don't know how you would report on it, but the stored proc allows you to create the chain of assemblies that you are looking for which CR just isn't able to do.
 
HTH
IP IP Logged
pgiering
Newbie
Newbie


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 37
Quote pgiering Replybullet Posted: 23 Nov 2009 at 9:48am
Thanks Lockwelle.  I have not used stored proceedures in CR before, so I'll have to look into how to add one.  I am a little more familiar with Business Objects than CR though, and if I understand the concept of stored proceedures right, it sounds a bit like adding a subquery in BO, which is how I would have handled it with that program.  So I think you are probably right about that being the way to go. 
 
I appreciate your reply, greatly!
 
Paul
IP IP Logged
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