wtgeographer

Access the first record only with search cursor

Discussion created by wtgeographer on Jun 5, 2014
How do i access the x attribute of the first record only with a search cursor?
   #Create SQL statement
    where_clause_envelope =  "\"{}\" = '{}'" "or " "\"{}\" = '{}'".format(Field,originValue,Field,destValue)#produces: "Name" = 'Amarillo 34th St'or "Name" = 'Coulter
 
    #Create temp layer for origin and destination
 
    Ends = arcpy.MakeFeatureLayer_management(subs, "Ends", where_clause_envelope)
 
    # Enter for loop for each feature
    for row in arcpy.da.SearchCursor(Ends, "SHAPE@X"):
        # Print x,y coordinates of each point feature
        #
        x = row[0]
        print x

Outcomes