Hi all, I am wondering if it's possible to make a script tool parameter showing or hiding depending on other parameter's value by user's inputing through coding in Validation or some other trick?
Thank you Strauch, I read the subject you posted and am working with ModelBuilder to see whether it can do.
I don't know if this will work, but if you choose a parameter type of "Derived" it will not show, but the user also doesn't have an option to choose either. But maybe you can work with that to get what you need.
Setting script tool parameters—Help | ArcGIS for Desktop
I don't think there's that much control over the script tool interface. I don't have a lot of experience with it though, maybe someone else knows for sure.
Thank you Terhune. It almost solve my problem, but it will be better if parameters invisible instead unselectable, or is it possible to popup another script parameters panel waiting for user's interactive inputs as an alternative?
It's part of the validation.
Understanding validation in script tools—Help | ArcGIS for Desktop
Parameter objects have a Boolean enabled property
Programming a ToolValidator class—Help | ArcGIS for Desktop
A parameter's value property returns an object, unless the parameter isn't populated, in which case the value returns None. To safeguard against a parameter not being populated, use a if check prior to using its value.The code snippet below tests whether the value is equal to the string "Get Spatial Weights From File". This test works because the parameter data type is a string.
A parameter's value property returns an object, unless the parameter isn't populated, in which case the value returns None. To safeguard against a parameter not being populated, use a if check prior to using its value.
The code snippet below tests whether the value is equal to the string "Get Spatial Weights From File". This test works because the parameter data type is a string.
<SPAN class="comment token"># If the option to use a weights file is selected, enable the</SPAN> <SPAN class="comment token"># parameter for specifying the file, otherwise disable it</SPAN> <SPAN class="keyword token">if</SPAN> self<SPAN class="punctuation token">.</SPAN>params<SPAN class="punctuation token">[</SPAN><SPAN class="number token">3</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>value<SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># check that parameter has a value</SPAN> <SPAN class="keyword token">if</SPAN> self<SPAN class="punctuation token">.</SPAN>params<SPAN class="punctuation token">[</SPAN><SPAN class="number token">3</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>value <SPAN class="operator token">==</SPAN> <SPAN class="string token">"Get Spatial Weights From File"</SPAN><SPAN class="punctuation token">:</SPAN> self<SPAN class="punctuation token">.</SPAN>params<SPAN class="punctuation token">[</SPAN><SPAN class="number token">8</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>enabled <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN> <SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> self<SPAN class="punctuation token">.</SPAN>params<SPAN class="punctuation token">[</SPAN><SPAN class="number token">8</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>enabled <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">False</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.