Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: This should be simple... Post Reply Post New Topic
Author Message
a58strod
Newbie
Newbie


Joined: 22 Apr 2011
Online Status: Offline
Posts: 2
Quote a58strod Replybullet Topic: This should be simple...
    Posted: 22 Apr 2011 at 3:10am
I swear this should be a straight forward formula but I'm hitting a wall.
 
I have 2 SQL tables; tblServiceOrders & tblReps
 
tblSerivceOrders.TechAssigned is linked with tblReps.RepID (numbers)
 
When you mark a service order as "unassigned" the TechAssigned field is 0
 
There is NOT a record in tblReps with a RepID of 0.
 
My goal is to group service orders by the assigned tech and also list the unassigned service orders on the report.  So far everything I've tried will not display service orders that are unassigned.
 
Here are the formulas I've tried:
 
If isnull({tblServiceOrders.TechAssigned}) then "Unassigned" else {tblReps.FirstName}
 
or
 
If {tblServiceOrders.TechAssigned} = 0 then "Unassigned" else {tblReps.FirstName}
 
or
 
If ToText({tblServiceOrders.TechAssigned}) = "0" then "Unassigned" else {tblReps.FirstName}
 
 
All of these group service orders by the tech's first name but unassigned service orders are MIA.
 
However,
 
If {tblServiceOrders.TechAssigned} = 0 then "Unassigned"
 
results in correctly marking unassigned service orders and leaving the rest of the service orders without anything in the field.
 
What am I missing?
 
Thanks!!!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 22 Apr 2011 at 3:39am

how are the tables linked?  if they are inner joined, there won't be any unassigned records.

isnull doesn't work, as the value is 0, not null.
totext doesn't work as the value returned is probably something like "0.00", try totext({table.field}, 0, "")
 
since the last one works but only gives unassigned and the middle one only gives the first name...it would seem that the middle one should work.  There is something about enforcing the join that might be at play. 
 
I've never really concerned myself with this as it doesn't affect my reports(they come from stored procs and only result in 1 wide table).  Between the enforce join and the inner / outer join, they might be clues .
 
HTH
 
IP IP Logged
a58strod
Newbie
Newbie


Joined: 22 Apr 2011
Online Status: Offline
Posts: 2
Quote a58strod Replybullet Posted: 22 Apr 2011 at 4:06am
Genius!
 
Full Outer Join fixed the problem along with using the middle formula.
 
Thank you!
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.015 seconds.