Select to view content in your preferred language

Trying to calculate values from a text field to a double field

1450
2
07-20-2011 10:19 AM
Pierre-LucFaucher
New Contributor
Hi,
I need help, I'm trying to do an "Field Calculator", to get values from a "text" field to a new field with data type "Double"? Seems to be working but the thing is that I have some numeric values with letters in it! Example : P4593. So the thing is that when my values are calculate, those one are represent by 0.
Is there a Script that can help me to calculate my values correctly?
Thx for helping me and sorry for my English!

Pierre-Luc
Tags (2)
0 Kudos
2 Replies
Robert_LeClair
Esri Esteemed Contributor
Pierre-Luc,

If all your text/string fields have the same format, P4593, for example.  Then you could use the Right VB syntax to extract the 4 right most characters.  In this case my formula would be:

NewField = Right ( [StringField], 4)

This would extract the right 4 "characters" --- 4593 --- and put it into the Double field.  If the [StringField] is like P45931, then you would update the formula to be:

NewField = Right ( [StringField], 5)

Then 45931 is calculated into the NewField field.

Hope this helps!

Robert LeClair
Esri-Denver
0 Kudos
RuthEmerick
Emerging Contributor
Double is a data type that does not support non-numeric characters (other than a decimal point). Would striping the alphabet characters and just having the number in the field meet your needs?
0 Kudos