Reputation: 604
I need the sum of two database fields. I use this formula field :
{dbfield1}+{dbfield2}
and if dbfield1
and dbfield2
are != from null in database the sum is showing, but if the dbfield1 or dbfield2 are missing(no data) the formula field is not showing.
how can I manage this in Crystal report?
Upvotes: 0
Views: 1259
Reputation: 12538
Two options :
Either use the Convert Database Fields to Null option under Report Options, which will convert the numeric field nulls to zero and make your sum work, or
Use the IsNull function in your formula :
If IsNull({dbfield1}) And IsNull({dbfield2}) Then
0
Else If IsNull({dbfield1}) Then
{dbfield2}
Else If IsNull({dbfield2}) Then
{dbfield1}
Else
{dbfield1}+{dbfield2}
Upvotes: 2