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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

to number

Status
Not open for further replies.

leburg

Programmer
Feb 15, 2006
64
US
I have a text field that is supposed to contain numeric data that I will need to convert to numeric to sum up. I managed to deal with odd negative notation and for the most part perform the conversion neatly...however...human error in data input throws a wrench into my plan, here and there. Problem is when a non-numeric string is encountered the report aborts with an error message stating non-numeric data...

How to get around it or correct this situation is what I'm asking...many thanks in advance for pointers or links.
 
You could try using val()instead of tonumber(). Val() would capture the values of numbers at the beginning of the string only though. Otherwise, you should show samples of the variation in the field, and also indicate whether the field can be null.

-LB
 
Try something like
Code:
if not isnull({your.field})
and NumericText({your.field})
then Tonumber({your.field})
This is based on Crystal 10. It also helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
numerictext ! check

Thanks, datildo!

Thank you both...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top