How to convert string to number with decimal points
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello, I have a requirement to create a number with 2 decimal points from a string field.
e.g.
'9079' to '90.79'
Also the length of the string is not always the same
any suggestions would be greatfully appreciated
Steve
Solved! Go to Solution.
- Labels:
- Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Wouldn't the easiest way be to convert the field into a number and then just divide by 100?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi, many thanks for that a very easy answer to my problem
regards
steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Besides the suggestion to give @DataBlender an ACCEPTED SOLUTION, I was wondering about the 2 decimal places. Are you converting 110 to 1.1 or to 1.10? Are you displaying the final result as a string? If you want to display the data, then:
ToString(ToNumber([Amount])/100,2)
If you also want a thousand separator:
ToString(ToNumber([Amount])/100,2,1)
Cheers,
Mark
Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Mark, no I wanted to convert my string to a number to then store as a currency value in SQL
but many thanks for the reply
regards
Steve
