Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Money field and a formula in CR7

Status
Not open for further replies.

PTW

Programmer
Jul 7, 2000
82
CA
The following fomula keeps generating an error in CR7 (forced to use 7 on a legacy system):

if isnull({eeCompensate.PayRate}) then
0
else
if {eeCompensate.PayRate} <> 0 then
Sum ({RegData.RegValue}, {eeEmployee.eeLink}) / {eeCompensate.PayRate}
else
0

The {eeCompensate.PayRate} field is a Money field in SQL Server, and this formula keeps returning the error "A number is required here" where I have the "/ {eeCompensate.PayRate}".

I originally built the report in CR8 and I had a similar problem, though I am not sure why. Using CDbl to convert {eeCompensate.PayRate} fixed the problem, but that does not seem to work in CR7. When looking at the table in the database, there are not any NULLS but there are several zero values.

Any ideas of what the problem is? Thanks!
 
You could try using:

/tonumber({eeCompensate.PayRate})

...instead of cdbl().

-LB
 
Thanks. I did end up using ToNumber(), but I am just not sure why I would have to in the first place.

Does CR not consider a Money field to be a number?
 
A money field is of currency datatype, which is different from a number field.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top