I have two feature classes which have common Valve ID #s. One table has multiple service connections with a unique number. I need to select all services linked to each valve and collect the individual service # then update the service fields (1-4) in the Valve class with each connection #.

I believe I can do it with an updateCursor but I'm not a strong coder.

    import arcpy, sys, string, os   
    valve = r"C:\valves.shp"
    services = r"C:\serviceConnectors.shp"
    fieldname1 = "ValveID"
    fieldname2 = "ConnectorServiceID"
    ucur = arcpy.UpdateCursor(valve)
    for urow in ucur:
        connectorlist = []
        valveid = ucur.GetValue(fieldname)
        sql = fieldname + " = " + valveid#This syntax probably won't work
        scur = arcpy.SearchCursor(services, sql)
        for srow in scur:
            connectorvalue = srow.GetValue(fieldname2)

This should get you started. You'll have to give more info on how you want the fields updated to add to the algorithm.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.