Select to view content in your preferred language

How to copy a column of numbers into a new column of text data type

5956
23
07-01-2015 08:41 AM
DanHoralík
New Contributor II

Hi, I'm a total amateur in ArcGIS. Can you please help me?

I have a table with a column in the "Double" data type. There are 6-digit numbers. Then I have another column (in the same table), which is empty and its data type is "Text, Length 6".

I need to copy the numbers from the first column into the second column. How do I do that?

I'm sorry, I even don't know if this is the right place to give this question.

0 Kudos
23 Replies
JoshuaBixby
MVP Esteemed Contributor

Use Calculate Field, it will do the type conversion from double to text for you.  (Making simple field calculations)

DanHoralík
New Contributor II

Can you be more specific? I created an expression [name of the first column] and it doesn't work.

0 Kudos
IanMurray
Frequent Contributor

Hi Dan,

In field calculator if you you swtich the parser to python and put

str(!YourfieldHere!) it should convert the numbers to strings(text)

DanHoralík
New Contributor II

OK, thank you Ian Murray very much and thanks also to Joshua Bixby. Now it magically works! That's great, have a nice day.

0 Kudos
IanMurray
Frequent Contributor

Glad you got it working.  If you have the time, please mark the question as answered.

0 Kudos
JoeBorgione
MVP Emeritus

Works for me.  I have a table with two fields.  One is of Short Int type the other text:

That should just about do it....
DanHoralík
New Contributor II

I am in the Edit session, so it's OK. I just can't figure, what expression I should use. I tried Str([nameofthefirstcolumn]) and it doesn't work.

0 Kudos
IanMurray
Frequent Contributor

Now I'm curious why what you said didn't work for him because it certainly worked for me in a test case as well as Joe.  Your reply was entirely correct and should have worked.

Dan Horalík​, could you check your geoprocessing results and see what the error was when using Josh's method for you.  This can be done by going to the main toolbar Geoprocessing dropdown>Results.  It should open a window showing all the geoprocessing operations you've performed.  Could you tell us the error message it gave you for the two operations that failed for you?

DanHoralík
New Contributor II

To be honest, Ian, I still have problems. I got some results, but from 500620 it turned into 500620.4 or what. I don't know whose method it was. Then I deleted those new data in the text column, because I neede just 500620 and not 500620.4 or what. Don't even know how it got there.

Error messages were about "invalid language". Once it was "name 'kod' (the name of the number column) is not defined.

I thought there is a problem with the number of significatn digits (as Jayanta wrote), so I set it to 5.

Now I'm in fact at the beginning, I don't know hot to calculate it.

0 Kudos