Select to view content in your preferred language

How To Build A Web Tool w/ Dependent Field Param That Pulls From Web Map Layer Selection

282
1
Jump to solution
03-02-2025 02:26 PM
__JackCharde__
Regular Contributor

Hey Everyone,

I published a web tool (based on a python script tool; .atbx, not .pyt) that contains a Feature Layer parameter with a default value, set as constant in the publishing pane (a feature service URL), and a multi-value Field parameter that is dependent on the Feature Layer parameter. This provides a dropdown for users to select fields they want summarized when the tool runs. The problem is that when publishing, this Field parameter is set as a choice list, and the resulting web tool hard-codes those field options into the tool.

My question is, is there a way to publish a tool that does not hard-code the choices and is instead reliant on what layer in the web map a user chooses (if I change how the aforementioned Feature Layer parameter is published)? This is currently being published to Enterprise 10.9.1, so I assume there are likely limitations alleviated in 11.x. I know the Summarize Within Analysis widget tool in Experience Builder allows for this, but that is only in AGOL or 11.x+, so I may just not be able to do it right now.

I can change the Feature Layer parameter to a choice-list as well, but it will just hard-code the layers from the active ArcGIS Pro map. Below is an image of the tools parameters tab showing my current setup.

__JackCharde___0-1740953886340.png

Best,

Jack C.

0 Kudos
1 Solution

Accepted Solutions
__JackCharde__
Regular Contributor

By reading the dang documentation, that's how you do it! I reread the input/output parameters documentation, and it mentions to set both your Feature Layer parameter and Field parameter (which should have a dependency on that Feature Layer) to user defined value. This avoids hard-coding, and waits for a map layer to be selected before pulling field info.

A multi-value Field type parameter is not supported in 10.9.1, so you can't set up a tool to enable you to choose multiple from a dropdown. It is supported in 11.x. I published the same tool to my 11.3 portal and was able to achieve what I'd originally asked about.

View solution in original post

0 Kudos
1 Reply
__JackCharde__
Regular Contributor

By reading the dang documentation, that's how you do it! I reread the input/output parameters documentation, and it mentions to set both your Feature Layer parameter and Field parameter (which should have a dependency on that Feature Layer) to user defined value. This avoids hard-coding, and waits for a map layer to be selected before pulling field info.

A multi-value Field type parameter is not supported in 10.9.1, so you can't set up a tool to enable you to choose multiple from a dropdown. It is supported in 11.x. I published the same tool to my 11.3 portal and was able to achieve what I'd originally asked about.

0 Kudos