In ArcMap 10.2, I'm attempting to build a tool that, when run, will iterate through a network of pipes to locate an outfall point. My network is composed of polyline data representing pipe, with input points at the junctions between polyline sections. Pipes have an Upstream and Downstream field, corresponding to Input points and Outfall points (at pipe terminus). My thinking is to have a user select a point in the network, at which point a search cursor in the input table would pull the ID value for said point, and feed it to a search cursor in the Upstream field of the pipe table. From there I would have two search cursors (one Upstream, one Downstream) iterate through until an Outfall value is reached in the Downstream field (all Outfall ID values begin with "OF"). All ID field values are strings.
I'm having trouble getting my initial search cursor to return only the value of the selected row for the input table. Here is my code so far:
import arcpy
arcpy.env.workspace = "C:\\Users\\Don\\Desktop\\Key\\Thesis\\Storm_Sewer"
arcpy.MakeFeatureLayer_management("GISDATA_STORM_INPUT_COMB", "inpLayer")
arcpy.MakeFeatureLayer_management("GISDATA_STORM_PIPE", "pipLayer")
fc = "inpLayer"
ds = "pipLayer"
pfield = "US_strip"
field = "ID_COMB"
bCursor = arcpy.da.SearchCursor(fc,field)
pCursor = arcpy.da.SearchCursor(ds,pfield)
for row in bCursor:
print(row[0])
Is it possible to have the searchcursor only act on the selected row? I had thought that, so long as the cursor was acting on a feature layer, this would occur automatically. Instead, this code feeds me back all the values in the field.