Hi. I have a column in a large attribute table. The values in this column are text.
Example entries in this case would be:
Bas
Rh
Pega
How can I add the word 'Log' to the end of each entry so it'd look like:
BasLog
RhLog
PegaLog
I don't want to use the technique or sorting them, then selecting them, then using field calculator to define them. I just want to know how to add text onto existing text, no matter what the existing text is.
thanks
Solved! Go to Solution.
Theo,
open the field calculator, right click the field you would like to add text and click "Field Calculator". Lets call this field FIELD.
then type the following in your field calculator:
[FIELD] + "Log"
That should do it.
Tim
Theo,
open the field calculator, right click the field you would like to add text and click "Field Calculator". Lets call this field FIELD.
then type the following in your field calculator:
[FIELD] + "Log"
That should do it.
Tim
Hi Theo,
The Field Calculator is the way to do this but you will need to check the code block option and input a rather simple function. Below I've provided steps using Python which I'm more familiar with:
When defining the function, be sure to use two spaces for each subsequent line under the function definition line (def replaceStr(string):) otherwise an error will be returned. The .replace() is the method used to append additional text to your input string field. I hope this helps and isn't too long winded for you .
Andy
thanks guys, i will try both techniques and report back!
EDIT: ok so I found Tim's solution was easiest and it worked fine for me. Although I didn't try Andy's, thanks anyway!
Glad it worked!
To follow on from Tim's ... for Pythonista's and those moving on to Arc* 10.3
Python parser
!FieldnameHere! + "log" # python uses ! to surround fields instead of [ ... ]
I'm using ArcGIS Pro 2.6. I want to add some text to an existing field. The following verifies as valid but throws an error:
https://community.esri.com/thread/231617-string-or-binary-data-would-be-truncated-error
I looked up the error. I guess the field length in my case was too short (255 length). I tried this same expression on a field with a length of 1600 and it was successful.