Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: How to display text when certain data is returned Post Reply Post New Topic
Author Message
bigmax098
Newbie
Newbie


Joined: 08 May 2008
Location: United Kingdom
Online Status: Offline
Posts: 14
Quote bigmax098 Replybullet Topic: How to display text when certain data is returned
     Posted: 09 Jul 2008 at 8:07am
I placed a field on my report that i want to sort by (department) and it only displays the ID, not the description as anticipated. E.g. Welding Department shows up as WD. My question is this: can i make a a formula that will display the text of "welding department" when "WD" is the data returned? Any help would be greatly appreciated! thanks! 
IP IP Logged
DJDUN
Newbie
Newbie
Avatar

Joined: 30 Jan 2008
Location: United States
Online Status: Offline
Posts: 6
Quote DJDUN Replybullet Posted: 09 Jul 2008 at 12:00pm
Hello!  Sure, that can be done by creating a formula field.  Create a new formula field, and use this type of structure:
 
if {your department field} = "WD"
then "Welding Department"
else
if {your department field} = "HR"
then "Human Resources"
else
so on and so on...
 
Now, the bad part about it is that you would have to have an if, then, else statement for each department.  If you do decide to go this route, then simply add it to your report where you would have put the other field that is just showing "WD".  Depending on the order that you want it sorted, you could sort either on the department field in your table, or the formula field that you have just created.  Hope this helps!!  Good luck!Big%20smile
IP IP Logged
bigmax098
Newbie
Newbie


Joined: 08 May 2008
Location: United Kingdom
Online Status: Offline
Posts: 14
Quote bigmax098 Replybullet Posted: 09 Jul 2008 at 12:48pm
AWESOME! Thanks a lot for your help, it worked perfectly. 
IP IP Logged
DJDUN
Newbie
Newbie
Avatar

Joined: 30 Jan 2008
Location: United States
Online Status: Offline
Posts: 6
Quote DJDUN Replybullet Posted: 09 Jul 2008 at 12:58pm
No problem!  Glad to help!Tongue
 
Take care!
 
IP IP Logged
bigmax098
Newbie
Newbie


Joined: 08 May 2008
Location: United Kingdom
Online Status: Offline
Posts: 14
Quote bigmax098 Replybullet Posted: 09 Jul 2008 at 1:18pm
One other question...if I wanted to omit a department would I still use a boolean?

So if I didn't want WD to show up...

if {department} = "WD' then ?????


IP IP Logged
amcb10
Newbie
Newbie


Joined: 10 Jul 2008
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote amcb10 Replybullet Posted: 11 Jul 2008 at 4:44am
From my limited Crystal experience you can omit the WD in the "report/select expert". Department <>WD which means it would ignore that department.
 
You can add this to the last line of your code too  "and" (without quotes) and the following line would be {department}<>WD
Hope that helped.
 
Andy
IP IP Logged
bigmax098
Newbie
Newbie


Joined: 08 May 2008
Location: United Kingdom
Online Status: Offline
Posts: 14
Quote bigmax098 Replybullet Posted: 11 Jul 2008 at 6:01am
That worked, thanks Andy. 
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