AnsweredAssumed Answered

Network Analysis Name Concatenation Split

Question asked by vshah6 on Apr 17, 2018
Latest reply on Apr 17, 2018 by vshah6

So I am using the Find Closest Facilities function of the Network Analysis license and the output has a field called NAME where it concatenates the Names of two of my features together like this: DESERT FOX - B - UTSL-HOME. I want to split it where I am only left with DESERT FOX - B.


What I am using is:

#I create a field a called name_id

arcpy.CalculateField_management(in_table, "name_id", "!NAME!.split(' - ')[0]", "PYTHON")

This however returns only DESERT FOX. Not what I am looking for and want DESERT FOX - B.


I tried to change the [0] to [:1] and to [:2] and those gave me errors.


The error I got was that the value type is incompatible with the field type. The field type is a string. 


How would I set up my Field Calculator to get my desired output?