Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Display value of different field when values equal Post Reply Post New Topic
Author Message
lsalih
Groupie
Groupie


Joined: 27 Sep 2007
Location: United States
Online Status: Offline
Posts: 44
Quote lsalih Replybullet Topic: Display value of different field when values equal
     Posted: 26 Mar 2008 at 2:16pm

I have table A

ID LASTNAME
1 JOHN
2 MIKE
3 GENE

ID IS Primary key


Table B

ID EID
1 3
2 1

 

ID and EID in table B are primary keys

tableB.ID is FK references TABLEA.ID

I want my report to display ID AND EID as following:

ID EID
JOHN GENE
MIKE JOHN

I placed ID And EID in detail section, right click ID field =>  Format Field = > Common

placed below formula under Display String

tableA.lastname

I was sucessful to display lastnames since tableA.ID is linked to tableB.ID

I did the same thing with EID, but I was not successful because tableA.ID is not linked to tableB.eid

I even put below formula, still won't work

If tableB.EID = tableA.ID then tableA.lastname

Can you please let me know what to do to display lastname feild from table A when tableB ID = TableB EID?

 

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 26 Mar 2008 at 3:25pm

If I understand you correctly, Table A links to Table B on ID.  But to get the data you want, you need to also link from TableB.EID to TableA.ID.  In order to do this, you need need to have two copies of Table A - one to link to TableB.ID and another to link to TableB.EID.

To do this, go to the Database Expert and add TableA again - Crystal will automatically "alias" the new copy of TableA as "TableA_1".  Set up your link from TableB.EID.  On your report, you'll use the name from TableA in your ID column and the name from TableA_1 in the EID column.

-Dell

IP IP Logged
lsalih
Groupie
Groupie


Joined: 27 Sep 2007
Location: United States
Online Status: Offline
Posts: 44
Quote lsalih Replybullet Posted: 27 Mar 2008 at 7:35am
Hello -
 
GREAT, IT WORKED..... That was exactly what I wanted .....
 
MANY THANKS TO YOU.
 
Regards,
Lava
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