AnsweredAssumed Answered

Explanation of or Examples demonstrating interaction between updateParameters and updateMessages

Question asked by allisonb on Jul 27, 2017

I am creating a python Toolbox that has the user select a geodatabase, and uses a hard-coded list of tables and associated field names to set the Value List filters for four additional parameters using the unique values in each of the specified fields.  

 

So, in the updateParameters code, I am checking for the presence of each table and associated field, and if they exist, setting the parameter's filter list to the unique values.  If not, I am clearing the filter list (set to []), and disabling the parameter. 

 

If the geodatabase does not contain the table/tables or field/fields needed to create the Value List filters, I would like to provide a custom error message to let the user know that the geodatabase is missing some of the necessary tables/fields.    However, it appears I cannot use setErrorMessage in updateParameters because it does not show up in the user interface.    And, in this case, because there will be internal errors (some missing values, because the parameter has been disabled), it looks like updateErrors does not get called.   I'm not sure about this last statement, because I am a bit unclear about how these class methods interact with what ArcGIS is doing behind the scenes.

 

I have combed the ESRI docs for custom toolboxes, as well as other materials that I could find, but am still have challenges with the code due to not quite knowing how these things flow.    Most of the code examples I've found are quite simple and/or do not use these methods, so I'm interested in finding other examples that might help clarify this issue.

 

As a related question, I am having some challenges with use of the "altered" versus "hasBeenValidated" parameter.   Some additional examples of comparing usage of these parameters would be helpful.  

Outcomes