Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: fields with similar values Post Reply Post New Topic
Author Message
lorimack
Groupie
Groupie


Joined: 03 Nov 2009
Online Status: Offline
Posts: 48
Quote lorimack Replybullet Topic: fields with similar values
     Posted: 16 Oct 2012 at 6:22am
hello, i have 2 fields im trying to add to a report. 
 
The first is officer, the second is investigator.  These fields are numbers in the database.  For instance officer 1 is smith and officer 2 is jones.
 
I need a formula that I can assign  the investigator field to point back to the employee table and pull the officers last name instead of the number. 
 
I made the formula {emmain.emlname} &","& {emmain.emfname} for a generic one, but I don't know how to assign the field so that
officer = {emmain.emlname} &","& {emmain.emfname} or
investigator = {emmain.emlname} &","& {emmain.emfname}
 
any suggestions on how i can assign those values to each individual field?
 
Thank you!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Oct 2012 at 7:29am
you would do this via adding emmian table to the report twice and linking the each instance of the tables to the each of the fields. Make sure to make outer joins if it is possible that either field is null.
then you can use the two formulas to make each name
 
{emmain.emlname} &","& {emmain.emfname}
 
and
 
{emmain_1.emlname} &","& {emmain_1.emfname}
IP IP Logged
lorimack
Groupie
Groupie


Joined: 03 Nov 2009
Online Status: Offline
Posts: 48
Quote lorimack Replybullet Posted: 16 Oct 2012 at 7:31am
how do I link them to the fields? 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Oct 2012 at 7:38am
in the Datebase expert drag the employee id code from the employee table to link to the other table's "officer" field.
repeat with the duplicated employee table (employee_1) to connect to the "investigator" field.
IP IP Logged
lorimack
Groupie
Groupie


Joined: 03 Nov 2009
Online Status: Offline
Posts: 48
Quote lorimack Replybullet Posted: 16 Oct 2012 at 7:46am
okay i got that and did this
 
{emmain_1.emlname} &","& {emmain_1.emfname}
 
I got the error message saying {emmain_1.emlname} field name now known.   is that from a joining issue?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Oct 2012 at 7:51am

did you open

Database Menu
select Database Expert
select your source on the left
add the emmain table to the selected tables
add the emmain table a second time which renamed it to "emmain_1"
click on the links tab and join emmain and emmain_1 to the other table?
IP IP Logged
lorimack
Groupie
Groupie


Joined: 03 Nov 2009
Online Status: Offline
Posts: 48
Quote lorimack Replybullet Posted: 16 Oct 2012 at 7:59am
yes i just went through all of those steps again to make sure. 
 
What type of join should it be between emmain and lwmain?  also between emmain.1 and lwmain?
 
Thank you for your help, i haven't done this in about 2 years lol
IP IP Logged
lorimack
Groupie
Groupie


Joined: 03 Nov 2009
Online Status: Offline
Posts: 48
Quote lorimack Replybullet Posted: 16 Oct 2012 at 8:02am
I got it!!!!!
 
Thank you again!!!!!Tongue
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