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

Converting string to numeric

Status
Not open for further replies.

DanCCC

Technical User
Aug 9, 2002
25
US
Hey all,

New to CRW but have written quite a few Access reports.

I'm getting donation data from our SQL server.

The donation amount is coming out as a STRING instead of numeric. I have already put in request to the programmers to change that.

In the meantime, is there a function to convert string data to numeric in my select functions?

Thanks in advance,

Dan Lee
Orlando, FL
 
If NumericText({your_column}) Then
ToNumber({file.REFERENCE})
Else 0;

hth,
- Ido CUT & Visual CUT: e-mailing, exporting, bursting, distribution, and scheduling of Crystal Reports:
 
That should be:

If NumericText({your_column}) Then
ToNumber({your_column})
Else 0;

- Ido CUT & Visual CUT: e-mailing, exporting, bursting, distribution, and scheduling of Crystal Reports:
 
Functions like Cdbl({field}) or ToNumber({field}) or Val({field}) convert strings to numbers.

Naith
 
Wow! THANKS Ido and Naith for incredibly fast responses. I put your formula into the Formula Editor, replaced my field with the Formula, created a new Select using the formula instead of the useless string data, and there it was. Fantastic!

Dan
 
I recommend Val() over ToNumber(). ToNumber crashes the report if it encounters a non-numeric string. Val will simply read up to the first alpha character and convert the numerics it finds. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top