I need this to loop through all the OBJECTID for the Fitting layer. Then it get the count for every line feature touching it. Now I'm at the point where I need the attribute table to be edited with that count. I have calculate field and I know arcpy.CalculateField_management is wrong and need to change I just don't know what it should change to.
Fitting = r'P:\YU_Restricted\Yuma_Admin\Projects\FY18\WO18_100_199\18-190_Gas_Utilities_Update_(Plicka_Joffre)\Gas_Utilites.gdb\UTILITIES_GAS\GasUtilNode_gControlFitting'
Pipe = r'P:\YU_Restricted\Yuma_Admin\Projects\FY18\WO18_100_199\18-190_Gas_Utilities_Update_(Plicka_Joffre)\Service\Service_Pipe.gdb\GasUtilNode_Segment'
# Process Selection Loop
with arcpy.da.SearchCursor(Fitting, ["OID@"]) as cursor:
for row in cursor:
# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(Fitting, "FittingLyr", "OBJECTID = " + str(row[0]))
# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management('GasUtilNode_Segment', 'BOUNDARY_TOUCHES', "FittingLyr", '#', 'NEW_SELECTION', 'NOT_INVERT')
# Process: Copy Features
arcpy.CopyFeatures_management('GasUtilNode_Segment', r'P:\\YU_Restricted\\Yuma_Admin\\Projects\\FY18\\WO18_100_199\\18-190_Gas_Utilities_Update_(Plicka_Joffre)\\results', '#', "0", "0", "0")
# Process: Get Count
arcpy.GetCount_management("results")
# Local variables:
lyrfile = "results"
result = arcpy.GetCount_management(lyrfile)
count = int(result.getOutput(0))
calcuFld = count
# Process: Delete
arcpy.CalculateField_management(Fitting,"mediaID",calcuFld)
arcpy.DeleteFeatures_management(r'P:\\YU_Restricted\\Yuma_Admin\\Projects\\FY18\\WO18_100_199\\18-190_Gas_Utilities_Update_(Plicka_Joffre)\\results')
arcpy.DeleteFeatures_management("FittingLyr")