Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
    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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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