Select to view content in your preferred language

Re: Joining values of two fields

3642
7
10-09-2015 07:05 AM
TerryGustafson
Frequent Contributor

Thanks that worked great..  I know I should post this in a new thread but was hoping for a quick answer.  I'm trying to join 2 fields.  the corridor field and the RM field.  I was thinking it would look something like this but cant seem to figure it out.  .join(!Corridor! + !RM!)

0 Kudos
7 Replies
JakeSkinner
Esri Esteemed Contributor

You can perform this in the field calculator.  Make sure you have 'Python' at the top of the field calculator checked and then the syntax would be:

!Corridor! + !RM!

TerryGustafson
Frequent Contributor

I tried that and it won’t work.. Not sure if it has something to do with it being a text field..

0 Kudos
JakeSkinner
Esri Esteemed Contributor

If you are calculating into a TEXT field, and on of the fields is an integer, try the following:

str(!Corridor!) + str(!RM!)

If not, let me know what type of fields Corridor, RM, and the field you are calculating to are.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Or try this tip

Field_calculator_tip_01.png

TerryGustafson
Frequent Contributor

That worked but it adds a .0 to the end of the RM..  I created the RM field as a short with 0 decimal places.  So it returned C000001E156.0.  The precision is set to 4

0 Kudos
TerryGustafson
Frequent Contributor

I got it..  Thanks for your help./.  Have a good weekend..

0 Kudos
curtvprice
MVP Alum
I'm trying to join 2 fields.  the corridor field and the RM field. Calculate Field (PYTHON) str(!CORRIDOR!) + str(!RM!) worked but it adds a .0 to the end of the RM..  I created the RM field as a short with 0 decimal places.  So it returned C000001E156.0.  The precision is set to 4

Try this Calculate Field syntax

arcpy.CalculateField_management(tbl, field, 
    "{}{:.0f}".format(!CORRIDOR!, !RM!), "", "PYTHON_9.3")
0 Kudos