Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Text to Numeric Conversion Post Reply Post New Topic
Author Message
adavis
Senior Member
Senior Member


Joined: 30 Oct 2012
Online Status: Offline
Posts: 104
Quote adavis Replybullet Topic: Text to Numeric Conversion
    Posted: 02 Jun 2014 at 5:16am
I have a text field that I am pulling from a database that represents a size value. I would like to convert that value from text to numeric in CR so that it will be compatible with another program where the data needs to be in short integer format.

The problem: ToNumber doesn't work because it has special characters throughout.

Data returned looks like this:

MeterSize
3/4"
5/8"
1/2"
2"

I tried using Replace (metersize, ""","") to remove the inch symbols, but I think crystal is having an issue with the symbol.

Any tips on taking out the inch symbols (")?
Any tips on getting CR to recognize the division symbol (/)?



                                          

Edited by adavis - 02 Jun 2014 at 5:18am
IP IP Logged
adavis
Senior Member
Senior Member


Joined: 30 Oct 2012
Online Status: Offline
Posts: 104
Quote adavis Replybullet Posted: 02 Jun 2014 at 6:49am
Anyone else curious about this, I found a solution but it doesn't involve CR. I had to export the table and use Excel to remove the ".

LEFT(A2, LEN(A2)-1)

If anyone has a crystal solution, I would still love to hear it. Thanks!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Jun 2014 at 7:18am
i believe you can also use the single quote around the double quote in a replace()
Replace (metersize, '"','')
IP IP Logged
adavis
Senior Member
Senior Member


Joined: 30 Oct 2012
Online Status: Offline
Posts: 104
Quote adavis Replybullet Posted: 02 Jun 2014 at 7:47am
Thanks DBlank. I didn't realize that was an option. Learn new tricks all the time from this community. Thanks so much!
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.