[GIS] How to combine text and integers in a string field

arcgis-10.1arcgis-desktopconcatenationfield-calculator

I have field with numbers in it (field type: double, number format: numeric) and I need to create a new field and put text in front of the numbers. I know that I need to add a new string field, but what is the proper expression to put into field calculator?

For example, if my number is 123, I want to change it to be abc123.

I'm using ArcMap 10.1

Best Answer

This will depend on what software you're using. Since you mentioned Field Calculator in your question, you are going to be using a programming language parser to convert values.

For Python (ArcMap, QGIS), you can use python's built in conversion functions. This page explains it fairly well and shows examples.

If you're using ArcMap and VBScript, there are a second set of functions you can use. They are explained here and provide examples, too.

Basically in either case, you are going to do a combination of the two fields while converting the one that needs it.

Python: stringField + str(numberField)

VBScript: stringField & CStr(numberField)

Warning: This isn't accounting for field value checking or anything that may throw a casting/conversion/type error.

Once you tell us which piece of software you're using, I can edit this answer with more detail and examples.

Related Question