Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: Link table to formula result Post Reply Post New Topic
Author Message
boldon mackem
Newbie
Newbie


Joined: 26 May 2009
Online Status: Offline
Posts: 9
Quote boldon mackem Replybullet Topic: Link table to formula result
    Posted: 14 Sep 2009 at 9:48pm
I have two tables which holds some of the same infromation, except one holds the location field as its name (Trading), and the other holds it as the location ID (JS001).
 
If  I create a formula to say if location ID = JS001 then "Trading".......
 
How can I link the database table "Trading" to the new formula "trading"?
 
Thanks,
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Sep 2009 at 10:03pm
You have to do this before the data gets into crystal. If your source allows for it you can do it there (e.g. a SQL view or stored proc) or you can do it in a Command in crystal using a CASE statement. That being said are you sure you do not have a way to join these? Most DB architecture would account for this. Maybe an intermediate table that both join to?
IP IP Logged
boldon mackem
Newbie
Newbie


Joined: 26 May 2009
Online Status: Offline
Posts: 9
Quote boldon mackem Replybullet Posted: 14 Sep 2009 at 10:11pm

I have been looking for an intermediatory table for about 3 hours and have drawn a blank.

 

How would  I do the "CASE" formula?



Edited by boldon mackem - 14 Sep 2009 at 10:13pm
IP IP Logged
boldon mackem
Newbie
Newbie


Joined: 26 May 2009
Online Status: Offline
Posts: 9
Quote boldon mackem Replybullet Posted: 14 Sep 2009 at 10:19pm
Ok, different tactic.  I have a common field in another table, however it is a string field, where  the other table has the same info as a "number" field.
 
Can these be converted?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Sep 2009 at 10:26pm
same premise. You would cast it in a command from one type to another.
 


Edited by DBlank - 14 Sep 2009 at 10:40pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Sep 2009 at 10:33pm
Your command would look something like
 
select tableA.field1, tableA.field2,...TableB.field1 ...all fields from both tables....
 
From tableA inner join tableB ON tableA.numberfield=CAST(tableb.stringfield as INT)


Edited by DBlank - 14 Sep 2009 at 10:40pm
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.016 seconds.