AnsweredAssumed Answered

AddMessage from SearchCursor

Question asked by ModernGIS on Jun 25, 2020
Latest reply on Jun 25, 2020 by bixb0012

I am working on fine-tuning my collection of Python Scripts and one thing I want to do is to add the AddMessage feature to my script. I have a particular script that produces a series of .PDF Graphs from a SearchCursor function. What I want to be able to do is each time an individual .PDF is created, I want to use the built-in SearchCursor with AddMessage to print a message to the screen showing the name of the .PDF created.

Here is a portion of my script.

 

list = []

rows = arcpy.SearchCursor(table)
for row in rows:
list.append(row.SERVICE_IDENTIFIER) # Double

del row, rows

# Remove duplicates from list
list = dict.fromkeys(list)
list = list.keys()

for n in list:
arcpy.TableSelect_analysis(table, r"in_memory\table_sel", "SERVICE_IDENTIFIER = " + str(n)) # Double

# Get TWACs_Number value
for row in arcpy.SearchCursor(r"in_memory\table_sel"):
SERVICE_ADDRESS = row.getValue("SERVICE_ADDRESS") # String

out_graph_name = n
out_graph_pdf = r"Z:\Operations\Maps and Records\GeoDatabase\MEWCO GIS System\GIS Attachments\Electric System\Electric Usage Demand Graphs\F1 Feeder ALL" + "\\" + str(n)[:-2] + ".pdf"
input_template = r"Y:\MEWCo GIS System - LOCAL\ELECTRIC SYSTEM\ELECTRIC GRAPHS - CONSTRUCT\GIS Graph Temps\ELECTRIC METER DEMAND - UPDATED 2020.grf"
input_data = r"in_memory\table_sel"

 

Thank You

Outcomes