Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: If True formula help Post Reply Post New Topic
Author Message
cappro1
Newbie
Newbie


Joined: 07 Jan 2009
Online Status: Offline
Posts: 1
Quote cappro1 Replybullet Topic: If True formula help
     Posted: 07 Jan 2009 at 5:40pm
I am using a if xxx = true formula, but i have multiple answers how i can display each one per line?
Here is the formula i am currently using. I have muliple answers that equal true and want to display each one separate.
Thanks in advance

If {CD_10_ttx.Projects~Udf_ccd1} = True then "1 "
else
If {CD_10_ttx.Projects~Udf_ccd2} = True then "2 "
else
If {CD_10_ttx.Projects~Udf_ccd3} = True then "3 "
else
If {CD_10_ttx.Projects~Udf_ccd4} = True then "4 "
else
If {CD_10_ttx.Projects~Udf_ccd5} = True then "5 "
else
If {CD_10_ttx.Projects~Udf_ccd6} = True then "6 "
else
If {CD_10_ttx.Projects~Udf_ccd7} = True then "7 "
else
If {CD_10_ttx.Projects~Udf_ccd8} = True then "8 "
else
If {CD_10_ttx.Projects~Udf_ccd9} = True then "9 "
else
If {CD_10_ttx.Projects~Udf_ccd10} = True then "10 "
else
If {CD_10_ttx.Projects~Udf_ccd11} = True then "11 "
else
If {CD_10_ttx.Projects~Udf_ccd12} = True then "12 "
else
If {CD_10_ttx.Projects~Udf_ccd13} = True then "13 "
else
If {CD_10_ttx.Projects~Udf_ccd14} = True then "14 "
else
If {Bond Project Status.Projects~Udf_ccdcw} = True then "CW"
Else "None Selected"
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Jan 2009 at 6:50pm
When using a multiple "if-then-else" statement it will stop at the first if condition it meets that it can satisfy. It will not continue through the statement to see if it meets anymore conditions. 
I am not exactly sure what you are trying to ultimately accomplish but, if all of your {CD_10_ttx.Projects~Udf_ccd_XX} fields are in the same row of data you can try to make 14 seperate detail sections and 14 formulas, one per condition and place each formula on a seperate detail section. Each formula will run independent of the others. Your formula will be something like:
If {CD_10_ttx.Projects~Udf_ccd1} = True then "1 "
else ""
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 08 Jan 2009 at 6:51am
Or you can create 14 variables in this formula and have then have the 14 formula to 'do' something else...it would be basically the same as DBlank says. 
Shared BooleanVar CW:=false;
If {Bond Project Status.Projects~Udf_ccdcw} = True then CW:=true
 
then in another formula
Shared BooleanVar CW;
 
if CW = true then
 ...
else
 ...
 
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