updateRows = arcpy.da.UpdateCursor(oesfHydroDislvFC, fieldList, sql_clause=(None, 'ORDER BY SL_WTRTY_CD, RIP_COMBO_UID DESC'))
arcpy.UpdateCursor(oesfHydroDislvFC, "", "", "", "SL_WTRTY_CD A;RIP_COMBO_UID D")
fieldList = ["SL_WTRTY_CD","RIP_COMBO_UID","CHAN_WIDTH"] updateRows = arcpy.da.UpdateCursor(oesfHydroDislvFC, fieldList, None, None, False, (None, 'ORDER BY SL_WTRTY_CD, RIP_COMBO_UID DESC'))
arcpy.da is a Defense Analyst module?Is there a reason to use a Search Cursor in arcpy.da instad of the one in arcpy?The standard arcpy Search Cursor sort fields syntax is "FIELD_1 A; FIELD_2 D" to sort the first assending and the second decending.Of course, in a different module the syntax could very well be very different.... after all, let's remember who wrote these modules.
You don't need to call reset(), you should be able to just do for row in arcpy.da.SearchCursor(layer,("SHAPE@","OID@"),sWhereClause,None,False,sql_clause): and avoid all that extra code.
for row in arcpy.da.SearchCursor(layer,("SHAPE@","OID@"),sWhereClause,None,False,sql_clause):
>>> dsc = arcpy.Describe("Demo.DBO.U1H000Ruimte") >>> OIDFieldName = dsc.OIDFieldName >>> delimitedFieldName = arcpy.AddFieldDelimiters("Demo.DBO.U1H000Ruimte", OIDFieldName) >>> print delimitedFieldName "OBJECTID" >>> sWhereClause = delimitedFieldName + " < 100" >>> print sWhereClause "OBJECTID" < 100 >>> sql_clause = (None,'ORDER BY OBJECTID DESC') >>> print sql_clause (None, 'ORDER BY OBJECTID DESC') >>> for row in arcpy.da.SearchCursor("Demo.DBO.U1H000Ruimte",("SHAPE@","OID@"),sWhereClause,None,False,sql_clause): ... print row[1] ... Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> TypeError: expected callable function - logger(obj)
sql_clause = (None,'ORDER BY "OBJECTID" DESC')
>>> for row in arcpy.da.SearchCursor("Demo.DBO.U1H000Ruimte",("SHAPE@","OID@"),sWhereClause,None,(None,'order by objectid desc'),None): ... print row[1]
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.