Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Changing Report into Subreport Post Reply Post New Topic
Author Message
Maleki
Newbie
Newbie


Joined: 23 Jan 2008
Online Status: Offline
Posts: 9
Quote Maleki Replybullet Topic: Changing Report into Subreport
     Posted: 23 Jan 2008 at 7:34am
Hey,
 
I inherited a report that's generated based on two parameter values.  It has several subreports attached to it.  I now need to generate a report for several combinations(1-2K) of these parameters. 
 
I can create a table with all required combinations of parameters but now I need to figure out how to modify the report.
 
Is converting it to a subreport the way to go?  Basically I want to replace the "enter parameter value" screen with a select from a table.  I didn't think it'd be hard... Dead
 
Any help would be appreciated.
 
M
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 23 Jan 2008 at 7:55am
It's not that hard.  Look up dynamic parameters in the help file, or in Brian's book.  I think you managed to whiz right by the easy solution, and got really tangled up in some strange, difficult solutions.


IP IP Logged
Maleki
Newbie
Newbie


Joined: 23 Jan 2008
Online Status: Offline
Posts: 9
Quote Maleki Replybullet Posted: 23 Jan 2008 at 12:14pm
hmmmm well I'm looking at dynamic parameters and it looks like when I set it it will give me a dropdown list of all the parameters I specified. 
 
Unfortunately I'm trying to have my report iterate through _all_ the parameters.  Can dynamic parameters do this?
 
Again thanks in advance,
 
M
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 24 Jan 2008 at 4:11am
OK, I think I'm not understanding quite what you want.  Can you give me a little sample data?  
IP IP Logged
Maleki
Newbie
Newbie


Joined: 23 Jan 2008
Online Status: Offline
Posts: 9
Quote Maleki Replybullet Posted: 24 Jan 2008 at 8:20am
Hmmm I appologize if I'm not being clear. 
 
Here's an example of what I want.
 
Let's say I have a report that generates a sales letter.  That report requires one parameter (let's say CustomerID).  So when I run the report it asks me for a CustomerID and it pushes out a report(letter).
 
I now want to push out a letter for every customer I have.  I have a table called Customers that has all of the CustomerIDs.  I'd like to feed all of those CustomerIDs into the report and have it generate all of the letters.
 
Does that help?  The crystal report(and subreports) and stored procedures was created by my predecessor.  It's pretty hairy looking so I want to modify it as little as possible.
 
I suppose I could write a wrapper in another language but I'd rather not have it come to that.
 
Again thanks in advance,
 
M
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 24 Jan 2008 at 9:42am
Ah ha!  Yes, now I get it.  And, re-reading your original post, that's what you said originally, too.  I just mis-read it.

Yes, embedding it in a larger report is the easiest solution.  It should be a fairly simple operation.


IP IP Logged
Maleki
Newbie
Newbie


Joined: 23 Jan 2008
Online Status: Offline
Posts: 9
Quote Maleki Replybullet Posted: 24 Jan 2008 at 12:26pm
All right I'll try that next.  I tried to do that before but the only thing that showed up was the detail row on the sub-report(there are several group headers).
IP IP Logged
Maleki
Newbie
Newbie


Joined: 23 Jan 2008
Online Status: Offline
Posts: 9
Quote Maleki Replybullet Posted: 26 Jan 2008 at 9:52am
Ok new question.  Can a sub-report have sub-reports?  I'm trying to do the loop thing but all of the reports sub-reports are gone.  Does that make any sense?
IP IP Logged
Maleki
Newbie
Newbie


Joined: 23 Jan 2008
Online Status: Offline
Posts: 9
Quote Maleki Replybullet Posted: 27 Jan 2008 at 5:09pm

Hmm aparently not. 

Hey I'm answering my own questions!  Oh well maybe this will help some poor soul trying to do this in the future.  At this moment I've got everything worked out (more or less) by redesigning the report.  I've run into a new issue though. 

The stored procedure puts data into a bunch of work tables.  My report pulls from those tables.  Fine.  Unfortunately those tables are cleared every time the sp is run(because I'm looping these work tables are cleared for each loop).  The data in the other parts of the report need to pull info from the work tables.   I guess technically I need one section to run first then the other ones to run after. 

So basically I'm trying to get this:

--Page 1
----Section A1
Report A1-Report that Depends on Results of Report B1
----Section B1
Report B1-Report that creates the data for the other sections.

--Page 2
----Section A2
Report A2-Report that Depends on Results of Report B2
----Section B2
Report B2-Report that creates the data for the other sections.

What I'm getting is this:

--Page 1
----Section A1
Report A1-Report that Depends on Results of Report B1
----Section B1
Report B1-Report that creates the data for the other sections.

--Page 2
----Section A2
Report A1-Report that Depends on Results of Report B1
----Section B2
Report B2-Report that creates the data for the other sections.

 

At the moment it looks like my only other option is to tweek to SP to put those rows somewhere else.  (I was hoping to avoid that.)  I've been mandated to use only Crystal and SQL as well (This would have been trivial in VB).

IP IP Logged
Alex
Newbie
Newbie


Joined: 28 Jan 2008
Location: Canada
Online Status: Offline
Posts: 22
Quote Alex Replybullet Posted: 28 Jan 2008 at 10:24am
Hi Maleki,
 
I already typed detailed answer for this but it disappeared...
Anyhow, solution for this is explained in "Prompting.rpt" a sample report that comes with CR XI...
You need to create a Command that will contain values to be used in dynamic prompt plus it will add "All" if you want to print all customers. In mentioned sample report created command is called GeographyPrompt, and it was done using UNION statement, here is  SQL from it:
SELECT Country, Region, City
FROM Customer
UNION
SELECT Country, Region, '...All'
FROM Customer
UNION
SELECT Country, '...All', '...All'
FROM Customer
UNION
SELECT '...All', '...All', '...All'
FROM Customer


Edited by Alex - 29 Jan 2008 at 9:56am
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