Select to view content in your preferred language

Server Geoprocessing Tool with Dynamic Input Parameter

38
1
yesterday
Layth
by
Occasional Contributor

I have created a custom Python Toolbox tool with an input parameter where the options are loaded from an attribute in a table in an Enterprise Geodatabase.  The parameter is of type GPString.  And the list of choices is generated in the updateMessages method.  Like this:

with arcpy.da.SearchCursor(projects, "ProjName") as rows:
    parameters[0].filter.list = sorted(list(set([row[0] for row in rows])))

All works great as a tool in Pro.

When I publish the tool to ArcGIS Server, it still works.  However the list of choices is now fixed.  If I add a record to the table in the EGDB, the new item is not provided as an option in the tool.

Is there a way to keep this dynamic as a server tool?

 

0 Kudos
1 Reply
DEWright_CA
Frequent Contributor

Do you have the DB registered as a DataSource in your ArcGIS Server? If you don't when the script is published it will snapshot the table.

0 Kudos