Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: If Then Formula Multiple Values Post Reply Post New Topic
Author Message
RcJ2
Newbie
Newbie


Joined: 31 Oct 2011
Location: United States
Online Status: Offline
Posts: 3
Quote RcJ2 Replybullet Topic: If Then Formula Multiple Values
     Posted: 09 Jan 2015 at 12:54pm
Help

I'm trying to create several formulas and a field I'm using has multiple values. Below is an example:

if {tblMemberRoles.Role_id} = 41 then Chr(253) else Chr(168)
if {tblMemberRoles.Role_id} = 42 then Chr(253) else Chr(168)
if {tblMemberRoles.Role_id} = 43 then Chr(253) else Chr(168)

Mind you, these are all different formulas. Each time I look at my report, the fields are blank. What exactly am I doing wrong?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jan 2015 at 4:29am
if you have NULL values you have to account for them by setting each formula to 'use default values for nulls'
IP IP Logged
RcJ2
Newbie
Newbie


Joined: 31 Oct 2011
Location: United States
Online Status: Offline
Posts: 3
Quote RcJ2 Replybullet Posted: 12 Jan 2015 at 5:18am
I do have null values for many people. How would I go about setting them up for nulls in my coding?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jan 2015 at 6:02am
in the formula editor there is a drop down option to set it to use defaults.
 
In code you have to address it as the first item of any if then
 
if NOT (isnull({tblMemberRoles.Role_id})) and {tblMemberRoles.Role_id} = 41 then Chr(253) else Chr(168)
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jan 2015 at 6:03am
much easier to set the default value option in each of the formulas but some people cannot find that setting
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