Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: OR statement not working correctly Post Reply Post New Topic
Author Message
MrPozor
Newbie
Newbie


Joined: 03 Feb 2012
Online Status: Offline
Posts: 2
Quote MrPozor Replybullet Topic: OR statement not working correctly
    Posted: 03 Feb 2012 at 4:08am
Hi,

I have a problem with an OR statement in Crystal Reports.

Basically I want to get a list of entries where either one of two checkboxes has been ticked.

I put the following into the record select:

{vPerson.pers_ma_1} = "Y" or {vPerson.pers_ma_2} = "Y"

but this does not list entries where ma_1="" and ma_2 ="Y"

If I reverse the formula, i.e.

{vPerson.pers_ma_2} = "Y" or {vPerson.pers_ma_1} = "Y"

I get the opposite, i.e. entries with ma_1="Y" and ma_2 ="" are missing.

Normally, for an OR statement the order of parameters should not matter, right? This is driving me insane!

Thanks for your help,

MrPozor
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 03 Feb 2012 at 5:11am
Hmm that is weird...
 
You could try using a nested if statement rather than or;
 
if {vPerson.pers_ma_1} = "Y" then True else
if {vPerson.pers_ma_2} = "Y" then True else False
 
Though I expect that would give the same results, maybe something to do with null fields but I can't say for certain.
 
Regards,
Ryan.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 Feb 2012 at 5:18am
likely it is NULLs.
if Null is not accounted for in the set up or in the formula it stops evaluating the formula when it hits a null and returns no value for that row.
 
In the formula editor (for your OR formula) set the pick list option to use 'default vaues for nulls'


Edited by DBlank - 03 Feb 2012 at 5:19am
IP IP Logged
MrPozor
Newbie
Newbie


Joined: 03 Feb 2012
Online Status: Offline
Posts: 2
Quote MrPozor Replybullet Posted: 03 Feb 2012 at 5:24am
You were both right about the NULLs.

Using the 'default vaues for nulls' works perfectly!

Thanks a lot for your help.

Kind regards,

MrPozor
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.