Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: IF then else issues Post Reply Post New Topic
Author Message
nsk74n
Newbie
Newbie


Joined: 08 Dec 2009
Online Status: Offline
Posts: 11
Quote nsk74n Replybullet Topic: IF then else issues
     Posted: 08 Dec 2009 at 10:52am
Good afternoon

At one point it used to work now it does not and I have another one that does work. Can someone tell me what is wrong with it?

-----------
if {DPACT.Collected} > 0
and {DPACPT.Collected} = 0
then "text1."
else if {DPACPT.Collected} > 0 and {DPACT.Collected} = 0
then "text2."
else if {DPACT.Collected} > 0 and {DPACPT.Collected} > 0
then "text3."
else ""
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Dec 2009 at 11:29am
what part does not work and do you have NULLS instead of 0's
IP IP Logged
nsk74n
Newbie
Newbie


Joined: 08 Dec 2009
Online Status: Offline
Posts: 11
Quote nsk74n Replybullet Posted: 08 Dec 2009 at 11:37am
I just figured out that DPACT.Collected is null but why didn't it hit my else. I actually put the word test in my "" and nothing came up.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Dec 2009 at 11:47am
NULLs can be the death of any good if-then formula.
If you do not care about NULLs and you want them to act the samea s Zero, in the formula editor change the option in the upper right corner from "Exceptions For Nulls" to "Default Values for Nulls"
IP IP Logged
nsk74n
Newbie
Newbie


Joined: 08 Dec 2009
Online Status: Offline
Posts: 11
Quote nsk74n Replybullet Posted: 08 Dec 2009 at 12:02pm
OHHHHHHHHHH, it does matter. That is so funny. It is always something so small. Thanks so much.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Dec 2009 at 12:06pm
No Prob.
It is actually a nice feature as often I need to differentiate between a NULL and a zero or an empty string so it is nice that it is easy to flip between the options.


Edited by DBlank - 08 Dec 2009 at 12:06pm
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