INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

String to number (with decimal)

String to number (with decimal)

(OP)
Hi,
In a universe object, I am trying to convert a string to a number if it's all numeric.  This is working fine - almost all of the time - using this formula:

DECODE( TRANSLATE(@Select(Class\Field),'_0123456789',' '), NULL, 'number','char')

So I am converting to 'number' or 'char'.  If it returns 'number', I convert it to a number.  The problem is when the value in the string is 100.00, for example.  It thinks it's a string because of the decimal.  How can I modify this logic to make a string, i.e. 100.00 evaluate so that I can convert it to a number?

Thanks!!

RE: String to number (with decimal)

Is this Crystal?  Crystal has NumericText, which should do the job.

yinyang Madawc Williams (East Anglia, UK).  Using Crystal 11.5 with SQL and Windows XP yinyang  

RE: String to number (with decimal)

(OP)
No, I'm building a webi report off a universe and that's where I've created my object.  I finally got this to work with a small tweak to my formula above.  I changed it to this:

DECODE( TRANSLATE(@Select(Class\Field),'_.0123456789',' '), NULL, 'number','char')

I added a decimal after the underscore and this works.  Thanks!
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close