Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Using the Add Command Post Reply Post New Topic
Author Message
Frank in VA
Groupie
Groupie
Avatar

Joined: 15 Nov 2007
Location: United States
Online Status: Offline
Posts: 46
Quote Frank in VA Replybullet Topic: Using the Add Command
     Posted: 27 May 2008 at 9:59am
Hi All,
I have a question on how to use the Add Command feature in the Database Expert.  I am modifying a report and adding an additional table.  I need to set this new table up with LEFT OUTER JOIN since the new table may not have a matching record in the Customer table.  I think I need to use the Add Command feature because the LEFT OUTER JOIN is not in the correct part of the SQL statement (Show SQL Query) and it's failing when there is no matching record thus giving me a blank report.  When adding a command in the Database Expert, how do I tie it in with the new table?  Do I need to remove the new table from the 'Links' page since the Command is being added?  Not sure what to do here.  Thanks in advance for your time!
 
Frank
Frank
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 28 May 2008 at 4:59pm
Right-click on the link to the new table and select Link Options.  You'll have the option there to change the link to a Left Outer join.
 
-Dell
IP IP Logged
Frank in VA
Groupie
Groupie
Avatar

Joined: 15 Nov 2007
Location: United States
Online Status: Offline
Posts: 46
Quote Frank in VA Replybullet Posted: 29 May 2008 at 5:52am

Thanks for the reply.  I had already tried that but it did not help.  I was experimenting a bit yesterday.  It looks to me that if I am using the Add Command feature in the Database Expert it needs to replace all the tables and SQL code in the report.  Because I get a message telling me that more than one datasource or a stored procedure has been used in this report.  And the Show SQL Query has two separate Select statements.  Do you know if this is true?

Thanks.
Frank
Frank
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 29 May 2008 at 7:34am
You can use both together (I've successfully done this several times!), but sometimes it works better to just include everything in the command.
 
-Dell
IP IP Logged
Frank in VA
Groupie
Groupie
Avatar

Joined: 15 Nov 2007
Location: United States
Online Status: Offline
Posts: 46
Quote Frank in VA Replybullet Posted: 30 May 2008 at 7:38am
I have removed all the tables and have just the Command now.  I am trying to get the parameter field to work.  When I create parameters in the Parameter List of the Modify Command window and click "OK", when I come back to the Modify Command window the parameters are gone.  It's not saving them.  When I use the parameters from the Field Explorer window, I get a syntax error.
 
Thanks,
Frank
Frank
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 30 May 2008 at 8:07am

Create the parameters in the Command window.  Then use them in your SQL like this:

{?parametername}

instead of the way you usually put parameters in your SQL outside of Crystal.

-Dell

IP IP Logged
Frank in VA
Groupie
Groupie
Avatar

Joined: 15 Nov 2007
Location: United States
Online Status: Offline
Posts: 46
Quote Frank in VA Replybullet Posted: 30 May 2008 at 1:33pm
YOU ROCK!!!   I'll need to do some more testing but the report looks like it's working fine.   Thanks for helping me work through all this.
 
Frank
Frank
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