Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: Linking fields on table with different Data Types Post Reply Post New Topic
Author Message
kcastillo
Newbie
Newbie
Avatar

Joined: 28 Nov 2008
Location: Spain
Online Status: Offline
Posts: 12
Quote kcastillo Replybullet Topic: Linking fields on table with different Data Types
    Posted: 28 Nov 2008 at 5:50am
I have problems modifying my SQL query on a report.
The table fields that are supposed to be linked have different datatypes.
 
I cleared all links from the database expert and on the Record Selection Formula inserted these to link the fields:
 
{T3772400.CPEDIDOS} = {TB080500.CPROPUES} + {TB080500.CINDPEDI} and
{T3772400.CEMPRESA} = Mid({TB080500.CEMPRESA},2,2)
 
But my SQL query result remains two separate tables...
 
 
KC
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 02 Dec 2008 at 11:28am
You will probably have to use a Command to write the whole SQL to get your data instead of using the tables directly in Crystal. 
 
What type of database are you connecting to?  Crystal doesn't allow commands for all of them, but will for the "standards" - MS SQL Server (through an OLE DB connection - I'm not sure if it's available on an ODBC connection), Oracle, etc.  To see if it's available for your database, open your report and then open the database connection.  If you see "Add Command" just under the database name, then you can write your own SQL to get the report data.
 
-Dell
 
-Dell
IP IP Logged
kcastillo
Newbie
Newbie
Avatar

Joined: 28 Nov 2008
Location: Spain
Online Status: Offline
Posts: 12
Quote kcastillo Replybullet Posted: 02 Dec 2008 at 11:39pm
Thanks!
 
I am using DB2 and an ODBC connection and was able to use add command and create my own query.
 
KC
IP IP Logged
kcastillo
Newbie
Newbie
Avatar

Joined: 28 Nov 2008
Location: Spain
Online Status: Offline
Posts: 12
Quote kcastillo Replybullet Posted: 03 Dec 2008 at 4:13am

Now I have a new problem using command and writing the SQL query... I am unable to specify parameters. 

 
Is this the cleanest way of solving the parameters issue?
KC
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 03 Dec 2008 at 8:41am
Actually, you can specify parameters.
 
- Remove any existing parameters in your report that you want to use in the SQL.
- In the window where you enter the SQL for the command, you have an option for creating parameters.  Create the parameters that you want to use in the SQL.
- In the SQL, use Crystal syntax for the parameters instead of the syntax for your database - e.g., "where mytable.myfield = {?parametername}".
 
-Dell
IP IP Logged
kcastillo
Newbie
Newbie
Avatar

Joined: 28 Nov 2008
Location: Spain
Online Status: Offline
Posts: 12
Quote kcastillo Replybullet Posted: 05 Dec 2008 at 1:36am
Thank you. This is such a simple solution!
KC
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.