Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Field from another table Post Reply Post New Topic
Author Message
Eleven
Newbie
Newbie


Joined: 08 Sep 2008
Location: South Africa
Online Status: Offline
Posts: 3
Quote Eleven Replybullet Topic: Field from another table
     Posted: 08 Sep 2008 at 2:07am
Hi everybody,

I'm quite new to Crystal Reports, I'd really appreciate it if you could help me out.

I need to display a field that is on a different table into my report, if I just drag the field directly from another table the report just hangs.

Here's an example of what I'm talking about...

I've got a table called "enterprise", which I used on the main report, then there's a second table called "enterprise_status".

Enterprise Table
==================
ent_id
ent_name
...
...
enterprise_status_code
country_code


Enterprise Status Table
==================
enterprise_status_code
enterprise_status_descr


Now on the main report I need to display the enterprise status description which is in the second table. At the moment to make the report work I had to add a new field with the following formula.

if {enterprise.enterprise_status_code} = "00" then "NO STATUS" else
if {enterprise.enterprise_status_code} = "01" then "STATUS DESCR 1"else
if {enterprise.enterprise_status_code} = "02" then "STATUS DESCR 2"else
if {enterprise.enterprise_status_code} = "03" then "STATUS DESCR 3"


The above code works fine but now I need another field called country, and I can't write the same kind of formula because there are too many countries.


Country Table
==================
country_code
country_name



Thanks in advance!
IP IP Logged
hsmead
Newbie
Newbie
Avatar

Joined: 08 Sep 2008
Location: United States
Online Status: Offline
Posts: 8
Quote hsmead Replybullet Posted: 08 Sep 2008 at 3:14am
Did you link the tables using the enterprise_status_code field?
Heather Phillips
803-834-6924
hsmead@aol.com
www.AccountingSolutionsForLess.com
IP IP Logged
Eleven
Newbie
Newbie


Joined: 08 Sep 2008
Location: South Africa
Online Status: Offline
Posts: 3
Quote Eleven Replybullet Posted: 08 Sep 2008 at 3:54am
No I didn't, how do I do that? The only thing I was able to link is a sub-report.
IP IP Logged
hsmead
Newbie
Newbie
Avatar

Joined: 08 Sep 2008
Location: United States
Online Status: Offline
Posts: 8
Quote hsmead Replybullet Posted: 08 Sep 2008 at 4:03am
Select Database Expert from the database menu.  You should have both tables selection on the Data tab, and on the Links tab you click on the field from table a and drag the mouse to the field to link to on table b.  A line should appear linking the tables by those fields.
Heather Phillips
803-834-6924
hsmead@aol.com
www.AccountingSolutionsForLess.com
IP IP Logged
Eleven
Newbie
Newbie


Joined: 08 Sep 2008
Location: South Africa
Online Status: Offline
Posts: 3
Quote Eleven Replybullet Posted: 08 Sep 2008 at 4:13am
Thanks a lot, it works!
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