Select to view content in your preferred language

Simple python script tool work differently when published (DataLayer, Field dependency)

605
2
03-23-2022 10:08 AM
MassimilianoGeppi
Esri Contributor

Hi

Writing a simple script in ArcGIS Pro, like this

import arcpy

"""The source code of the tool."""
fc_orig = arcpy.GetParameter(0)
fc_origkey = arcpy.GetParameterAsText(1)

When i run it in ArcGIS Pro i can interact with layers in the TOC and observe the list of field in the combobox change the values as aspected

MassimilianoGeppi_0-1648054127010.png

This beacuse the tool properties are set, as visible in this other picture

MassimilianoGeppi_1-1648054269333.png

But when the same tool it was  published as "web tools" in the portal we have a corrisponding tool that doesn't have the same behavior.

MassimilianoGeppi_2-1648054676623.png

In effect the second filed (combobox) doesn't update the values when the first combobox change layers, in the TOC as it happens in ArcGIS Pro?

Hoping i was clear i waiting for an idea.

Thank you in advance

max

 

 

 

2 Replies
DonMorrison1
Frequent Contributor

I'm not surprised by this based on my experience with publishing Python toolboxes.  The  tool's "updateParameters" function, which provides the ability to react to parameter value changes, is never called in the published version of the tool, so the parameters are basically static, based on what the tool returns from the "getParameterInfo" function (which is called only when the tool is initialized).  I've never used dependent parameters so I'm not sure how that is affected. 

I was trying to find the ESRI help page that discusses this limitation but can't seem to find it right now. 

MassimilianoGeppi
Esri Contributor

Hi Don,

Thank you for your reply, yes we need an "Esri Help" or a "workaround" about this topic because we must to solve for an important customer.

How to populate dinamically a combobox of fields when i change the corresponding datalayer, selected from the TOC using a scripting tool published like a service.

m

0 Kudos