AnsweredAssumed Answered

AddMessage question

Question asked by aimong on May 24, 2013
Latest reply on May 28, 2013 by aimong
How would you do this using AddMessage instead of print and in a script tool? My code has a parameter and where_clause in the search cursor so the user inputs a name and I would like a message listing field values.

ESRI expample:

import arcpy # Open a searchcursor #  Input: C:/Data/Counties.shp #  Fields: NAME; STATE_NAME; POP2000 #  Sort fields: STATE_NAME A; POP2000 D rows = arcpy.SearchCursor("c:/data/counties.shp",                           fields="NAME; STATE_NAME; POP2000",                           sort_fields="STATE_NAME A; POP2000 D")  # Iterate through the rows in the cursor and print out the # state name, county and population of each. for row in rows:     print("State: {0}, County: {1}, Population: {2}".format(         row.getValue("STATE_NAME"),         row.getValue("NAME"),         row.getValue("POP2000")))