Improve ModelBuilder validation code to not use "stale" values

165
0
10-19-2010 01:00 PM
Status: Open
Labels (1)
LoganPugh
Occasional Contributor III
Description: In ModelBuilder, when the Calculate Value tool is used to return a value, processes that depend on that value do not use the newly calculated value in their validation routines, but instead use the value previously returned when the model was saved. If the validation fails because of this, the model will not run at all. In some instances, the model may run but fail on the process that uses the calculated value because it is still using the "stale" value. This makes it difficult to share models (especially those intended to be used from the tool dialog as generic tools) with other users, because the values saved in the model created by the author may be invalid on other systems (file paths, etc).
 
Workaround: Have the user open the model and run it once so that the necessary Calculate Value tools are in a "have been run" state on that user's system and save the model. Caveat: This requires more user interaction than may be desired for generic tools intended to be used from the tool dialog.
 
Possible solutions/improvements:
1) Put a checkbox on the Calculate Value tool that indicates the tool should be run before the validation code on dependent processes (including those with a precondition to the result of the Calculate Value tool)
2) Add the ability to override validation errors on a per-parameter basis using an option on each model processes' dialog.
3) Improve tool validation code across the board to be more aware of processes using Calculate Value and/or in-line variable substitution to be less stringent/more intelligent in those cases
 
There may be better ways to handle this but it would improve ModelBuilder immensely to have more flexibility in the way your model handles validation so that your model works for both the author and other users.