Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: Crystal report and queries Post Reply Post New Topic
Author Message
signil
Newbie
Newbie
Avatar

Joined: 18 Nov 2009
Online Status: Offline
Posts: 4
Quote signil Replybullet Topic: Crystal report and queries
    Posted: 18 Nov 2009 at 6:00am
Hi,

I am trying to create a crystal report with basically three fields - orders, site and contract.

I have a SQL query to fetch the data for me based on certain conditions, my question is how I can integrate that into my report?

I tried using the Crystal report SQL designer, exported the query and then tried to add the .qry file as a data source for the report. But it doesn't work, please advise on the same

Thanx,
User 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 18 Nov 2009 at 6:17am
create a stored procedure and use that as your datasource.  By far the most versatile way to gather data.
 
HTH
IP IP Logged
signil
Newbie
Newbie
Avatar

Joined: 18 Nov 2009
Online Status: Offline
Posts: 4
Quote signil Replybullet Posted: 18 Nov 2009 at 8:53pm
A stored procedure? Do you mean in the SQL designer? And once again export? How would I use a procedure as a data source? Please help..
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 19 Nov 2009 at 6:19am
a stored procedure a list or a batch of SQL commands that you create on the Database that are executed as a group.
 
In CR, where you select the tables that you want on the report, instead of selecting the Tables, a couple of lines down is Stored Procedures, find the stored procedure that you created for your report and select it.  That is pretty much all that you have to do as far as setting it as a datasource.  Then just drag and drop as you would before.
 
HTH
IP IP Logged
signil
Newbie
Newbie
Avatar

Joined: 18 Nov 2009
Online Status: Offline
Posts: 4
Quote signil Replybullet Posted: 20 Nov 2009 at 10:50pm
OK, I think I have my procedure ready, one LAST question - is it advisable to group and sort your records through crystal reports or use a procedure to do the work for you? What are the different scenarios? 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 23 Nov 2009 at 6:08am
Since my reports tend to have multiple sorts, I get lazy and let CR do it.  With that said, one would think that if you brought your set out in the order that you want it, CR should render the report more quickly (since it doesn't need to sort, just read).  So, I would recommend sorting in SQL if it is not too much bother.
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.032 seconds.