Crystal 8.5 on XP
I'm probably making this harder then it needs to be. I've got a numeric field (conthist.duration) which contains time and sales amounts depending on the conthist.rectype field. Thus "T" = time or "S" = Sale or "S U" = unsuccessful sale. First I'm trying to get a dollar amount to show correctly for a sale to total a day of business. However, if it's not an "S" or "S U" conthist.rectype I don't want it to show anything. If it is an "S U" then I want it to show "$0.00".
My formula works but doesn't allow me to total a day correctly.
Field Name: @Sale
If {ContHist.RECTYPE} = "S U" then "0.00" else
if {ContHist.RECTYPE} = "S" then (CStr(val({ContHist.DURATION})))
I would have liked to avoid the conversion of the numeric value "ContHist.RECTYPE" to a string, (CStr(val({ContHist.DURATION}))), but thats the only way I could get it to work with the first half of the equation.
Ok, that explained I need help with two things.
#1. I would like to show that value as Dollars (curency).
#2. I would like to sum the result but since it's text I can't sum(@Sale). Guess because it is text? So I created a second field SaleConvert and tried variations of the following. CDbl(val({@Sale})) While it does return values they are not conistantly correct. Thus $800 shows correctly as $800.00 but $1000 shows as $1.00 and $1500 also shows as $1.00.
Sorry this is so long but I'm trying to explain my complete issue in one shot. Thanks!
I'm probably making this harder then it needs to be. I've got a numeric field (conthist.duration) which contains time and sales amounts depending on the conthist.rectype field. Thus "T" = time or "S" = Sale or "S U" = unsuccessful sale. First I'm trying to get a dollar amount to show correctly for a sale to total a day of business. However, if it's not an "S" or "S U" conthist.rectype I don't want it to show anything. If it is an "S U" then I want it to show "$0.00".
My formula works but doesn't allow me to total a day correctly.
Field Name: @Sale
If {ContHist.RECTYPE} = "S U" then "0.00" else
if {ContHist.RECTYPE} = "S" then (CStr(val({ContHist.DURATION})))
I would have liked to avoid the conversion of the numeric value "ContHist.RECTYPE" to a string, (CStr(val({ContHist.DURATION}))), but thats the only way I could get it to work with the first half of the equation.
Ok, that explained I need help with two things.
#1. I would like to show that value as Dollars (curency).
#2. I would like to sum the result but since it's text I can't sum(@Sale). Guess because it is text? So I created a second field SaleConvert and tried variations of the following. CDbl(val({@Sale})) While it does return values they are not conistantly correct. Thus $800 shows correctly as $800.00 but $1000 shows as $1.00 and $1500 also shows as $1.00.
Sorry this is so long but I'm trying to explain my complete issue in one shot. Thanks!