Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula handling Nulls? Post Reply Post New Topic
Author Message
techsupport
Groupie
Groupie


Joined: 03 Jun 2014
Location: United States
Online Status: Offline
Posts: 41
Quote techsupport Replybullet Topic: Formula handling Nulls?
    Posted: 08 Jul 2016 at 9:30am
Currently have the following formula:

if {Address.SubUnitTypeId} = 0 or IsNull({Address.SubUnitTypeId}) or IsNull({Address.SubUnit}) or IsNull({AddressSubUnit.Description}) then {Address.StreetOne} else
if {Address.SubUnitTypeId} <> 0 then {Address.StreetOne} + '  ' + {@SubUnit}


however when the Nulls are True, it is NOT showing the Address.StreetOne
I am unsure why?
____________________
Thank you very much!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Jul 2016 at 3:17am
the NULL has to always be the first condition so in your first two conditions
"if {Address.SubUnitTypeId} = 0 or IsNull({Address.SubUnitTypeId})"
it hits the null and evaluates for = 0 first and then stops because it it does not know how to handle the null.
I find it easier to just use the option in the formula editor to 'use default values for nulls' then you can just use the "<> 0" or "= 0"

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.