Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Need a formula Post Reply Post New Topic
Author Message
avishalpatil
Newbie
Newbie


Joined: 24 Dec 2010
Online Status: Offline
Posts: 13
Quote avishalpatil Replybullet Topic: Need a formula
     Posted: 07 Jul 2011 at 6:59am
Hi ,
I have some "Gender" attribute in a database carrying values as follow:
        1 - Male
        2 - Female
        3 - Not Specified

I want following should display on report.
        Male
        Female
        Not Specified

Please suggest me the formula for this.

Regards & Thanks
Vishal
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Jul 2011 at 7:10am
I think you are asking how to convert numbers to text?
 
if table.gender=1 then 'Male' else if table.gender=2 then 'Female' else if table.gender=3 then 'Not Specified' else 'Missing'
 
the else missing is optional but I usually add this to label items that are not in the rest of the formula statement tather than leave them blank
IP IP Logged
avishalpatil
Newbie
Newbie


Joined: 24 Dec 2010
Online Status: Offline
Posts: 13
Quote avishalpatil Replybullet Posted: 07 Jul 2011 at 7:18am
Nope.

Complete string is coming from a database field i.e
(1 - Male).

I just want to print only Male.Other portion of the string i.e (1 - ) should be truncated.

Regards
Vishal
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Jul 2011 at 8:04am
right(field,length(field)-4)
IP IP Logged
avishalpatil
Newbie
Newbie


Joined: 24 Dec 2010
Online Status: Offline
Posts: 13
Quote avishalpatil Replybullet Posted: 07 Jul 2011 at 8:07pm
Thanks Dude !!!
It working....
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