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

5725
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
DanHoralík
New Contributor II

I didn't do anything and now the numbers in both the columns are exactly the same, there are no .0. It's probably because I finished the edit session, so the .0 have disappeared. In the end, if there was the length of the text set to 6, it can't be any longer, right?

Now everything is okay for me.

Thank you very much and thank to everyone else who gave me a piece of advice. I was quite confused but with your help and help of others I succeded

So have a nice day and thanks!

PS: I'll mark this as answered.

0 Kudos
DanHoralík
New Contributor II

I hope I have marked this as answered. I clicked on something and now it says: "An implicit answer is expected at this question" (translated from my language to English). I hope this is it!

0 Kudos
DarrenWiens2
MVP Honored Contributor

It sounds like you have two issues:

1.) Your numeric field is actually storing more digits than 6, so trying to jam it directly into a string field of length 6 will result in truncation, and/or warnings.

2.) Your expression depends on which parser you use

TL;DR - use the round() function, regardless of parser.

Say you have some numbers in a double field that are set to display zero decimal places:

1.PNG

As Ian Murray describes, the field still holds values:

1.PNG

VB Script parser:

Expression: [POINT_X]

Result: Truncation (warning)

1.PNG

Expression: int( [POINT_X] )

Result: Incorrect rounding (truncation)

1.PNG

Expression: round( [POINT_X] )

Result: Success!

Python Parser:

Expression: !POINT_X!

Result: Incorrect rounding (truncation)

Expression: int(!POINT_X!)

Result: Incorrect rounding (truncation)

Expression: round( !POINT_X! )

Result: Success!

DanHoralík
New Contributor II

Thanks Darren, but no, it doesn't store more digits than 6. I had just been messing with lowering the number of significatn digits from 6 to 5. But this was not a good solution because it rounded some numbers, so I got wrong numbers.

About the expressions, now I understand them, brackets and exclamation marks.

I was just quite confused, but now everything is solved and it's alright.

0 Kudos