Print Page | Close Window

Convert text to a number

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=4663
Printed Date: 03 May 2024 at 8:55am


Topic: Convert text to a number
Posted By: JNiemeyer
Subject: Convert text to a number
Date Posted: 29 Oct 2008 at 12:26pm
I have a text value ".281296" that I want to convert to a number. Whenever I use the Cdbl() or ToNumber() functions, it always rounds off the number to 2 decimal positions  .29  ???   Why does it do this, and how do I tell Crystal to convert the text to the number .281296 ?



Replies:
Posted By: o2bnsv
Date Posted: 07 Nov 2008 at 12:17pm
you need to specify in the cdbl() formula how you want the number to format or how many decimal places you want.  For example, if you want your field to format to 6 decimal places, the formula would be as follows:
 
cdbl({table.field},"##.######").  There is a great crystal help article about formatting numbers as strings.  Just type 'format strings' into the help search.



Print Page | Close Window