Mathew Paul
Mathew Paul

Reputation: 663

Convert string to number field

I have a Database field whose datatype is String in Crystal Reports. How can I convert it to a number value?

Upvotes: 9

Views: 136101

Answers (1)

user359040
user359040

Reputation:

Within Crystal, you can do it by creating a formula that uses the ToNumber function. It might be a good idea to code for the possibility that the field might include non-numeric data - like so:

If NumericText ({field}) then ToNumber ({field}) else 0

Alternatively, you might find it easier to convert the field's datatype within the query used in the report.

Upvotes: 33

Related Questions