I have a model that has a buffer distance as a parameter. In the attribute table I would like to show this user inputted value. How do I calculate field based on a parameter?
Solved! Go to Solution.
To calculate field to a parameter, you use the model variable in the Calculate Field expression. At runtime, the model variable get substituted in before the Calculate Field tool runs.
"%buffer size%"
I would like to have this field be "dynamic" and update itself by what the user inputs as a buffer value, i.e 5ft 10m or 20yds.
Hi Darren,
I am getting stuck with the variable substitution. My parameters are the feature class and a buffer distance of 10 feet. My expression for calculating the field value is "%Distance%", which is derived from the user parameter. What should my expression be? SQL, String, etc.
Thanks again
Jacob, you should not use the quotes I led your wrong there. The quotes get passed literally so it looks like you are trying to calculate a string into a numeric field in the Calculate Field tool.
What is inside the %'s gets passed as if you typed it into the tool, so if Distance is 50, you should add a field buf%Distance% which is seen by Add FIeld as buf50.
If you are entering a buffer distance as linear unit ie 50 feet, you need to manipulate this string with Calculate Value, for example use the expression "%Distance%".split()[0] to get 50 out.