Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Joining stored procedures on parameters Post Reply Post New Topic
Author Message
Joshua
Newbie
Newbie
Avatar

Joined: 12 Jun 2008
Online Status: Offline
Posts: 2
Quote Joshua Replybullet Topic: Joining stored procedures on parameters
     Posted: 12 Jun 2008 at 10:31am
I'm fairly new to Crystal Reports, so this is probably easy, but I'm having trouble figuring it out.

I have four stored procedures I'm trying to incorporate into one report.  They are similar to:

CityList(State) - returns list of cities in State
SubdivisionList(City) - returns list of subdivisions in City
StreetList(Subdivision) - returns list of streets in Subdivision
HouseList(Street) - returns list of houses on Street

When I run the report, I want to provide one parameter - State - and have the stored procedures joined to provide all the info.  So, for each city returned by CityList(State), SubdivisionList(City) should be called to retrieve that data.  I realize this is impractical, but is it possible?  If so, how do I do it?  Since there are 4 layers, subreports aren't possible.

I would alter them into one stored proc but our DBA doesn't like there being a stored procedure that could return all Houses in a particular State.  (Just an example, my dataset is actually much smaller.)

Thanks!
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 12 Jun 2008 at 9:59pm
Unfortunately, your DBA won't like Crystal Reports. CR has DCPs (dynamic cascading prompts) which du what you want. But they only work by generating one massive (in your case) resultset and then it filters the data by elminating rows in the resultset. They don't have a way to break it up into separate calls (which would be much more efficient and make your DBA happy).

I cover DCPs in great detail in Chapter 4 of my Encyclopedia book. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Joshua
Newbie
Newbie
Avatar

Joined: 12 Jun 2008
Online Status: Offline
Posts: 2
Quote Joshua Replybullet Posted: 13 Jun 2008 at 7:54am
Brian,

Thanks for your help.  I'm not sure that DCPs are actually what I'm looking for as the user won't be giving further input into which city, subdivision, or street they are looking for.  The issue the DBA has is that he doesn't want a single procedure to return so much data for security purposes. 

In the example I used above, he wouldn't want a single stored procedure to return

State | City | Subdivision | Street | House #

as that gives someone knowing a state code essentially a data dump of a ton of info.

What he would want is one proc that returns all the cities for a state.  Then a proc that returns all the subdivisions for a city would have to be called once for each city.  Then a proc that returns the streets would have to be run once for each sub in each city.  Eventually way too many calls are made to the database and every house # in the state is returned, but it is "stronger" security-wise as there is no single call that returns all the data. 

Perhaps I am just misunderstanding DCPs, so let me know if I am.

Thanks!
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