I have a File Geodatabase Table(no geometry). I am trying to update the last column, called S_Name from concatenated values from other fields. I am going to write out my logic so it is clear what I want to accomplish
if the PRE_TYPE field is not Null and the SUF_TYPE field is null then update S_Name to the values of PRE_TYPE+NAME+SUF_MOD
if PRE_TYPE is Null and SUF_TYPE is Not Null then update S_Name to NAME+SUF_TYPE
Here is my code below. I am pretty sure the logic is sound. The script runs with no errors but does not print bah, and does not update the table.
import arcpy arcpy.env.workspace = "C:path\\Tran_road_NJ.gdb" layer = "C:path\\Tran_road_NJ.gdb\\Tran_road_geocode_NJ_1" with arcpy.da.UpdateCursor(layer, ['PRE_TYPE','NAME','SUF_TYPE','SUF_MOD','S_Name']) as rd: for x in rd: if x != None and x != None and x == None: bah = x+' '+x +' '+x x = str(bah) print bah rd.updateRow(x) elif x == None and x != None and x != None: bah = x+' '+x x = str(bah) print bah rd.updateRow(x)