True, I guess I didn't read the requirements very well:oConcatenation: A + B = AB.Requirements description: If A or B then A or B, else nothing
import arcgisscripting gp = arcgisscripting.create(9.3) inputFC = r"C:\temp\test.gdb\test" fieldName1 = "THIS_FIELD" fieldName2 = "THAT_FIELD" concatFieldName = "CONCAT_FIELD" updateRows = gp.updatecursor(inputFC) updateRow = updateRows.next() while updateRow: if updateRow.getvalue(fieldName1) == None and updateRow.getvalue(fieldName2) != None: updateRow.setvalue(concatFieldName, updateRow.getvalue(fieldName2)) elif updateRow.getvalue(fieldName1) != None and updateRow.getvalue(fieldName2) == None: updateRow.setvalue(concatFieldName, updateRow.getvalue(fieldName1)) elif updateRow.getvalue(fieldName1) != None and updateRow.getvalue(fieldName2) != None: updateRow.setvalue(concatFieldName, str(updateRow.getvalue(fieldName1)) + "-" + str(updateRow.getvalue(fieldName2))) else: print "FUBAR" updateRows.UpdateRow(updateRow) updateRow = updateRows.next() del updateRow del updateRows
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.