Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula Issues in crystal report 9 Post Reply Post New Topic
Author Message
dipubhargavan
Newbie
Newbie


Joined: 06 Dec 2010
Online Status: Offline
Posts: 3
Quote dipubhargavan Replybullet Topic: Formula Issues in crystal report 9
     Posted: 09 Dec 2010 at 2:40am
Hi All,
I have a report which shows all the employees.employee and their supervisors.employee. Both are numbers and unique. I want to create a formula in crystal which shows whether the listed employees.employee is there in the supervisor.employee table. If the listed employees.employee is there in the supervisor.employee then it has to show as Yes else NO.Please help
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 09 Dec 2010 at 3:23am
I would probably do a join (not sure which one..left?) on supervisor.employee (since the records will most likely be a subset of employee.employee) and then see if there's some fields in supervisor.employee that will be null because the particular employee was not on the supervisor.employee table

Then your formula can check if the field is null or not and display Yes or No appropriately.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 09 Dec 2010 at 3:34am
if would be an outer join, an inner join would give an empty record set.  I don't know either as I use outer joins in SQL, but haven't needed them in Crystal so I don't know which table is on the left.
 
The more I think about it, the more I am drawn to a select statement like:
select e.employee, s.employee AS employeeS from employee as e left join supervisor s on s.employee = e.employee
 
if s.employee is NULL, then the record is not in the supervisor table, if it has a value, it is there.  There is a possiblity of multiple records this way if the employee has more than 1 record in the supervisor table.
 
HTH 
IP IP Logged
dipubhargavan
Newbie
Newbie


Joined: 06 Dec 2010
Online Status: Offline
Posts: 3
Quote dipubhargavan Replybullet Posted: 13 Dec 2010 at 7:14pm
Thanks for the reply, could you please help me to create a formula for this to show whether the listed employee is there in the supervisor table.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 14 Dec 2010 at 4:07am
if isnull({supervisorTable.employeeID}) then
  "Yes"
Else
  "No"
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