Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formual Field Post Reply Post New Topic
Author Message
enduroman
Newbie
Newbie
Avatar

Joined: 14 Sep 2009
Location: United Kingdom
Online Status: Offline
Posts: 2
Quote enduroman Replybullet Topic: Formual Field
     Posted: 14 Sep 2009 at 6:55am
Hi - i am new to crystal reports - so what i hope is a basic question - which i am obviously getting wrong. We are using V9
 
I am trying to create a formula field that will enable me to print out either the discounted price or if there is no discount the non discounted price.
 
I have created a formula field called "value" and was trying to use the following logic:
 
if {SFSOP.SOP_DISCOUNT} <> 0 then {@discounted price}*{SFSOP.SOP_REF_QTY}
else {SFSOP.SOP_PEACH_CONVERTED}*{SFSOP.SOP_REF_QTY}
 
I have inserted the @value filed on a line in the rpeort and on is printed for each report line
 
For some reason when i run the report there is no value displayed in any of the rows where i do not have a discount  in the SFSOP.SOP_discount field.
 
I think i am doing something obviously wrong and  appreciate any advice.
 
Thanks 
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Sep 2009 at 7:30am
Likely this is because it is NULL instead of 0. The "<>0" won't deal with NULLs.
Try and invert it to deal with the 0 and NULL then the other as the else...
 
if isnull({SFSOP.SOP_DISCOUNT}) or {SFSOP.SOP_DISCOUNT}=0 then {SFSOP.SOP_PEACH_CONVERTED}*{SFSOP.SOP_REF_QTY} else{@discounted price}*{SFSOP.SOP_REF_QTY}
IP IP Logged
enduroman
Newbie
Newbie
Avatar

Joined: 14 Sep 2009
Location: United Kingdom
Online Status: Offline
Posts: 2
Quote enduroman Replybullet Posted: 14 Sep 2009 at 10:56pm
Thanks very much that seemed to do the trick!!
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