0

I have a lengthy field list and would like the dialog box to show script progress on a single line, rather than returning to a new line.

what I have:
field1
field2
field3 ....

current code:

for fieldName in fieldList.split(';'):
    arcpy.gp.CalculateField_management(inFeature, fieldName, "2")
    arcpy.gp.AddMessage(fieldName)

what I would like:
field1, field2, field3, ...
I don't want to simply list the fields, but keep the list updating with a new field separated by a comma each time on the same line

6
  • 2
    Are you talking about background or foreground Geoprocessing? Have you looked into SetProgessor? desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-functions/…
    – PolyGeo
    Commented Aug 27, 2016 at 2:56
  • Foreground processing. I did see SetProgressor but I was hoping to use AddMessage (or something else) to see updates in the dialog box. Commented Aug 27, 2016 at 4:07
  • While I think this can be done with a print statement, I don't believe it can be done using arcpy.AddMessage()
    – Midavalo
    Commented Aug 27, 2016 at 4:46
  • @bleegp the SetProgressor will allow you to display text
    – Midavalo
    Commented Aug 27, 2016 at 4:53
  • you can display tex with SetProgressorLabel: arcpy.SetProgressorLabel("Loading {0}...".format(shp)) Commented Aug 30, 2016 at 9:10

1 Answer 1

1

This is How you will use SetProgressor:

You can try this progress bar functions. May be you need a little modification according to your python versions. So, I donot know that dialog box is possible in arcgis custom tool box. But you can see the progresses in progressbar labels as you expected I hope.

count=1
arcpy.SetProgressor("step","Calculating fields for fieldnew Values", 0, len(fieldList),1)
    field_names=["..."]
    for fieldName in fieldList.split(';'):
        field_name.insert[count-1, fieldName] 
        arcpy.SetProgressorLabel(" Calculating field :{}".format(fieldName))
        arcpy.gp.CalculateField_management(inFeature, fieldName, "2")
        arcpy.SetProgressorLabel("We are done with {}".format(field_names))
        #arcpy.gp.AddMessage(fieldName)

    count=count+1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.