Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: If statements IN If Statements Post Reply Post New Topic
Page  of 2 Next >>
Author Message
swatts
Groupie
Groupie
Avatar

Joined: 17 Mar 2010
Online Status: Offline
Posts: 83
Quote swatts Replybullet Topic: If statements IN If Statements
     Posted: 25 Mar 2010 at 6:07am
How is this done?

If blah then blah
else if blah2 and if blah2 = "Other" then blah2

I think it is called nestled ifs?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Mar 2010 at 6:18am

too many ifs in there...

 
If blah then blah
else if blah2 and if blah2 = "Other" then blah2
 
should be
 
if blah then blah else
if blah2 and blah2='Other'  then blah2
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 25 Mar 2010 at 6:18am
Yes, depends on whether you are using Crystal Syntax or Basic Syntax (available I think after version 8.5).
 
The help explains it pretty good.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 25 Mar 2010 at 6:19am
Opps, missed the extra if.
IP IP Logged
swatts
Groupie
Groupie
Avatar

Joined: 17 Mar 2010
Online Status: Offline
Posts: 83
Quote swatts Replybullet Posted: 25 Mar 2010 at 6:32am
Ok. I will try that. Basically I want an "Also If"

Does that make sense?
IP IP Logged
swatts
Groupie
Groupie
Avatar

Joined: 17 Mar 2010
Online Status: Offline
Posts: 83
Quote swatts Replybullet Posted: 25 Mar 2010 at 6:34am
I have a field that if it is one thing I want it to state X and if it is another thing I want it to state the Y, but also if it the Y AND it has this Z, I want it to say YZ

Edited by swatts - 25 Mar 2010 at 6:35am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Mar 2010 at 6:56am
Start at your most complex ancd work your way down because an IF - THEN stops as soon as it meets the condition.
That being said I have a feeling you are talking about comparing multiple rows of data. That is more complex.
Can you post real examples of row level data and the value you want returned.
IP IP Logged
swatts
Groupie
Groupie
Avatar

Joined: 17 Mar 2010
Online Status: Offline
Posts: 83
Quote swatts Replybullet Posted: 25 Mar 2010 at 7:38am
I was attempting to not show something if it didn't need to be. Our project manager said she didn't mind it being on there. So I didn't have to do this. Sorry for that and thank you for your time.
IP IP Logged
swatts
Groupie
Groupie
Avatar

Joined: 17 Mar 2010
Online Status: Offline
Posts: 83
Quote swatts Replybullet Posted: 25 Mar 2010 at 9:22am
Well back to the drawing board. This is what I am trying to do. If the field is not empty, then put this value. However, if it is not empty and of this value, then add this. If it is not empty and of this other value then add this. Basically, there are 3 choices.

if not isnull ({Ack_Receipt_Handbook.assessment_fee_check_Value}) then
'<b>ASSESSMENT FEE:</b>' & Chr(13) & ({Ack_Receipt_Handbook.single_access_fee_Value})
and if ({Ack_Receipt_Handbook.single_access_fee}) = "20" then & ({Ack_Receipt_Handbook.box_at_appt_income})
else if ({Ack_Receipt_Handbook.single_access_fee}) = "30" then & ({Ack_Receipt_Handbook.box_reduced_percent}) & " "
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Mar 2010 at 10:19am
if not isnull ({Ack_Receipt_Handbook.assessment_fee_check_Value}) then
'<b>ASSESSMENT FEE:</b>' & Chr(13) & {Ack_Receipt_Handbook.single_access_fee_Value} &
(if {Ack_Receipt_Handbook.single_access_fee} = "20" then {Ack_Receipt_Handbook.box_at_appt_income}
else if {Ack_Receipt_Handbook.single_access_fee} = "30" then {Ack_Receipt_Handbook.box_reduced_percent} & " ")
IP IP Logged
Page  of 2 Next >>
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