Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Queries Executed when Previewed from Designer Post Reply Post New Topic
Author Message
adutt
Newbie
Newbie


Joined: 24 Nov 2008
Online Status: Offline
Posts: 3
Quote adutt Replybullet Topic: Queries Executed when Previewed from Designer
    Posted: 24 Nov 2008 at 1:04am
Hi,
I have a crystal report in which there is a dynamic prompt.In the prompt screen this value is populated through a command object say Command 1. I have another command object Command 2 which actually fetches the report data. The command 2 object also depend on some static parameter values which come up on the parameter screen.When I preview the report in crystal client Both Command1 and Command2 gets executed before the parameter screen appears. Whereas only command1 is required to generate the parameter screen. Command 2 gets executed with the value to the static parameters as their default value.Since Command2 also gets exceuted before the prompt screen appears, it causes the prompt screen to appear only after a long wait. Thus in essence command2 get executed twice during the exceution of the report, once before the parameter screen screen and once after we fill up the parameter screen and hit ok. How can we get command2 not to run before the parameter screen comes up? Any help will be highly appreciated.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 24 Nov 2008 at 7:12am
OK, I'll bite, why is Command2 getting the report data?  Why not a stored procedure, then you could get rid of Command2.
 
The way that I use the command objects is to populate the parameter lists, so I want them to run before before the parameter screen.
 
I'm no expert, but I don't think that Crystal was designed to fetch the report data off of the command objects.  I could be wrong, but either a stored proc or table joins would seem to be the better alternative.
IP IP Logged
adutt
Newbie
Newbie


Joined: 24 Nov 2008
Online Status: Offline
Posts: 3
Quote adutt Replybullet Posted: 24 Nov 2008 at 9:24pm
a

Edited by adutt - 24 Nov 2008 at 9:40pm
IP IP Logged
adutt
Newbie
Newbie


Joined: 24 Nov 2008
Online Status: Offline
Posts: 3
Quote adutt Replybullet Posted: 24 Nov 2008 at 9:32pm
Hi lockwelle,
            thanks for the reply.I am fetching the data from Documentum writing a DQL query. DQL is very similar to SQL with some restrictions.One of which is it does not allow to write stored procedures.Thus I can't use a stored proc.However the problem is not because of DQL. or Documentum.I have tested with SQL server and the same thing happens.My point is shouldn't the crystal engine be intelligent enough to understand which command objects should be executed to bring the parameter screen up and which should be executed later to fetch the data.It will be helpful if you could explain what you meant " by joining tables". In the query in the command object (Command Object 2 -> which actually fetches report data)I am actually joining a number of tables and performing filter criteria.If you could suggest anything it will be very helpful.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 25 Nov 2008 at 6:19am
What I meant by 'joining tables' is going to Database/Database Expert and selecting the tables that you want in your report.
 
Typically, this is how you would tell Crystal to fetch data for the report.  This can be tables, views, stored procedures.  The parameters screens are gather the input you need to for the stored proc or to filter the data so that your report displays the data as desired.
 
I don't believe that the command object was ever intended by Crystal to be used for data fetching, I believe that it was intended to make the parameter input more robust and allow for dynamic table driven values to appear in the input parameter screens as opposed to hardcoding static values.
 
Just as path to a solution, and I can't guarantee it will work, but maybe you could try to move your DQL statement in the SQL statement of the report.  Modify the SQL of the report on Database Show SQL Query...It is something that you could try.  I might have done this years ago when I first writing reports, but haven't lately as I use XML for my datasource.
 
Hope this helped.
 
As another path to try, in the command object, include an 'if' statement that is predicated on one of the parameters that has not been filled in, then at least the first time through the command object will not retrieve data.
 
Just some thoughts, again, hope that they help
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.