1

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.

3
    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)
            connectorlist.append(connectorvalue)

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

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.