Select to view content in your preferred language

Controlling Parameter Visibility in python script tool with Batch Mode

156
2
2 weeks ago
DasheEbra
Frequent Contributor

Dear GIS folks, I recently developed a Python script tool in ArcGIS Pro 3.3, which includes 10 parameters. In the standard user interface (non-batch mode), I added some validation lines to streamline the tool’s usability: by default, only three parameters are visible initially. The first parameter allows users to select files, while the other two are checkboxes that, when selected, reveal additional sub-parameters for specific workflows.

DasheEbra_1-1731247763102.png

 

Everything works smoothly in single-mode, but I’m encountering an issue in Batch mode. In Batch mode, all parameters are displayed at once, unlike the streamlined view in the regular UI. After extensively searching Esri’s help documentation and Esri community, I couldn’t find a solution to replicate the same functionality in Batch mode.

I even reviewed the Esri GP tool "Convert Labels to Annotation" which has a similar configuration (parameters toggled based on checkboxes). However, this tool also displays all parameters in Batch mode, ignoring the checkbox-based parameter toggling.

Could anyone share insights or solutions on achieving selective parameter visibility in Batch mode, or is this functionality not feasible?

0 Kudos
2 Replies
AlfredBaldenweck
MVP Regular Contributor

Anecdotally, I've never gotten this to work. The best I can do is change one of the input parameters to multivalue.

Not sure if there's official documentation out there about this, but I don't think they considered matching in user-made tools.

 

DasheEbra
Frequent Contributor

Hi @AlfredBaldenweck, unfortunately I ended up addressing the issue using a multi-value selection within the parameter. This approach lead me to update the main code, where I wrote two additional functions to manage this, along with handling the validation part also. I'm hoping we'll see some useful updates related to this functionality in the future.

On a related note, I also managed to handle the parameter using Batch mode, but it currently works for parameter values only. Which I wrote a validation step that ensures when the end user provides two required parameters, the last three parameters are automatically set to %Name% or %Name% + 'any other value', which seems to work well for now. And here's snippet of the validation part 

 

if not self.params[2].altered:
    self.params[2].value = "%Name%" if self.params[7].value else sanitized_name  # Output dataset name
else:
    self.params[2].value = self.params[2].value

 

0 Kudos