Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula question - check multiple fields in one Post Reply Post New Topic
Author Message
Kilantro
Newbie
Newbie


Joined: 15 May 2011
Online Status: Offline
Posts: 3
Quote Kilantro Replybullet Topic: Formula question - check multiple fields in one
     Posted: 05 Sep 2011 at 8:38pm
Hi
 
Sorry if this s stupid question or has been asked before...can't find it.
 
I need to write a simple formula to populate a columbn in a report.
It needs to look at 4 fields in the database and give a different value if each condition is true...
 
E.g.
if  {Table.Field1} = "7"  then "5"
else if {Table.Field2} = "7" then "6"
else if {Table.Field3} = "7" then "7"
else if {Table.Field4} = "7" then "8"
 
This obviosuly isn't working...
is it possible...and how!!??!!
 
Thanks,
 
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 06 Sep 2011 at 12:12am
To use an If then else formula you need to tell it what the alternative is for a false return.Something like  If {table.field1} = "7" then "5"
                                                    else {table.field1};
                                               If {table.field2} = "7" then "6"
                                                    else {table.field2};
                                               If {table.field3} = "7" then "7"
                                                    else {table.field3};
                                               If {table.field4} = "7" then "8"
                                                    else {table.field4}
IP IP Logged
Kilantro
Newbie
Newbie


Joined: 15 May 2011
Online Status: Offline
Posts: 3
Quote Kilantro Replybullet Posted: 06 Sep 2011 at 11:59am
Thanks for your response!
 ....but that doesn't work either
 
The 2nd , 3rd and 4th if else staments don't get read in the formula and an error message appears.
 
Is there another way to do it apart from an if/else?
 
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 06 Sep 2011 at 9:52pm
Try substituting "and" for the " ; "
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