Solved! Go to Solution.
You can create a value list filter for model parameters, among other filter types. Once the user selects a value, it can be accessed by inline variable substitution.
Are you supposed to be able to 'plug' your own data in the script linked to by the ESRI staff above?
I downloaded the model and followed instructions on blog here step by step as suggested. But the model doesn't seem able to accept my data - it only seems to work with provided data.
Trying to execute the model after doing as instructed results in either in an empty output, see "Results Window", or I'm simply unable to select a Type and Field, for example see "Error". Both images attached as below.
In my data I've tried the following with no success;
- reduced the number of columns and records as I was getting an "Out of Range" error - this stopped occuring after reducing records from 1000 to 33;
- created a string column exactly like that used in the example data for the drop list to run off;
- Tested the sub-model in a new empty model, and also opened up the model and tested it.
Can anyone help with what I've missed (perhaps updating file locations or the like??), or was this tool not designed to take anyone elses data?
I have used it with my data and as long as I do not exceed the maximum number of records allowed in the list and account for the field's type I do not get an error with my data. The model has a Selection query string that is built assuming that your field is a string type, so if your field type is a numeric or date field that will generate an error until you correct the way the inputs build the Select query filter string.
At least several hundred values can be added to the list before an error is generated. I plan to add code to determine exactly how many values can be added before that error occurs, so that I can halt the list growth and provide a warning to the user. A seed value parameter could be added to the tool to provide a Like statement or Min and Max limit to prefilter the record set so that the user would have some control of what values will be included in the list while avoiding the index out of range error. Validation code could be added to let the filter value be optional if no index out of range error is detected and required if the error is detected, rather than just letting the tool fail.
Is there anything else I can try?
Did you catch the fact in the download that the second parameter for the Field does not have the Obtained From setting correct in the Script tool? Open the script Properties, go to the Parameters tab, click the Field parameter in the top list (the second parameter listed). In the settings at the bottom of the dialog make sure the Obtained From setting is pointing to "Feature_Class_Table" (the correct name of the first parameter) and not "Input_Feature_Class_Table".
If that does not help, open the tool in the model and choose the input values again to make sure each parameter responds to the validation script and then screenshot the script input dialog with the input values you are providing (don't cover it up with an error message). Then screenshot the tableview of the input data.