I do have a little problem in my business logic of my Python tool.
In case the user does not have street and municipality names for the addresses the fields 'Municipality names' and 'Street name' should not only be disabled but also not Required. However, when the appropriate checkbox is set to False these Fields are required.
Is there any possibility to disable a parameter in a Python toolbox that the parameterType is neglected?
Also, that I have to give a parameterType to a checkbox (or GPBoolean), or that there is a 'Required' given as default value is a bit weird.
Looking forward to any suggestion on how to solve these issues.
A couple of months ago I had the same problem and after some research found that the "Required" parameter property is read-only as documented here:
Customizing tool behavior in a Python toolbox
As a workaround, what I did was if a box was checked or textbox was filled in, I would use the addIDMessage and add error 735.
000735 : <value>: Value is required.
What this did was that when the value was enabled, I could make the text box required and when the user went to run it, it would through an error asking for that value to be filled in.
Does this help?
it sounds like a solution, although I do not fully get through it.
Would you have some code example to illustrate it?
How do you deal with the parameterType of the textboxes initially and how do you influence them by using the AddIDMessage?
I don't have a code sample just yet but what would happen is that when your add the id message, that id message would only appear if the textbox is enabled. If the textbox is disabled, the id message would not display.