There might be a more elegant way to do this, but here is a quick & dirty script base on my understanding of your problem:
import arcpy
arcpy.env.workspace = r'C:\Users\echiasson\Documents\ArcGIS\Default.gdb' # Replace correct geodatabase path
arcpy.env.overwriteOutput = True
# Make a copy of the original feature class
arcpy.Copy_management('left_right_merge', 'left_right_merge_collapse')
# Collapse the output feature class
nodeList = []
with arcpy.da.UpdateCursor('left_right_merge_collapse', ['NODE']) as cursor:
for row in cursor:
if row[0] in nodeList:
cursor.deleteRow()
else:
nodeList.append(row[0])
for node in nodeList:
# Compile the values in the original feature class
attList = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
with arcpy.da.SearchCursor('left_right_merge', ['NB_L','NB_R', 'SB_L', 'SB_R', 'NWB_L', 'NWB_R', 'NEB_L', 'NEB_R', 'SWB_L', 'SWB_R', 'SEB_L', 'SEB_R', 'EB_L', 'EB_R', 'WB_L', 'WB_R'], "NODE = " + str(node)) as cursor:
for row in cursor:
for i in range(0,15):
if row[i] != 0:
attList[i] = row[i]
# Update the values in the collapse feature class
with arcpy.da.UpdateCursor('left_right_merge_collapse', ['NB_L','NB_R', 'SB_L', 'SB_R', 'NWB_L', 'NWB_R', 'NEB_L', 'NEB_R', 'SWB_L', 'SWB_R', 'SEB_L', 'SEB_R', 'EB_L', 'EB_R', 'WB_L', 'WB_R'], "NODE = " + str(node)) as cursor:
for row in cursor:
for i in range(0,15):
row[i] = attList[i]
cursor.updateRow(row)
Please leave a comment if I am missing something.
nodevalue in four records with one value. The goal is to collapse them into one as shown in the top table while keeping all fields, so you end up with one record with four values. – Chris W Jun 25 '14 at 00:33