Select to view content in your preferred language

Setup model to prompt user to type in value - Calculate Field tool

1166
3
10-15-2011 03:39 AM
MarkFawkes
Regular Contributor
I am trying to set up a model that as part of the model will calculate a value for a text field by prompting the user to enter a value to be entered (using the Calculate Field tool. The prompt is for the user to type in a value rather than selecting from a list.

I can set the the Expression as a parameter but cannot seem to find a way to get the tool to prompt for a value. It is probably something basic that I am not doing, but the help and documentation I have seen is not making sense to me or at least does not work the way I think it should.
0 Kudos
3 Replies
NobbirAhmed
Esri Regular Contributor
In ModelBuilder, create a variable (right-click and select Create Variable ...) of String type. Make it a model parameter. Refer to this variable to Calculate Field as an inline variable.

Follow this topic if you need help:
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002w0000001t000000

And for examples, see:
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Examples_of_inline_model_variable_subs...
0 Kudos
MarkFawkes
Regular Contributor
Thanks Nobbir

What you suggest was what I thought I had to do and still cannot get it to work.

I have a feature class TestFile which has a field Test which is a text field. I have created a variable named String of string type, and set this as a model parameter. In the Calculate Field tool dialog, I have set Input Table as TestFile, Field Name as Test and Expression as %String%. This has no value set.

What I want now is to run the model and have a window open to input a value for the variable String as a user input when the model is run. From my reading I had a vague idea that this is what would happen. When I run the model, I get an error 000622 (parameters not valid) and 000735 (Value is required).

It is this last bit (getting Arc to prompt me to enter a value for String) that does not seem to work as I thought it should work.

Any help on this would be appreciated. I am using ARc 10 on a trial installation from one of the ESRI books.
0 Kudos
NobbirAhmed
Esri Regular Contributor
Enclose the expression with triple-quote as:

"""%String%"""


This expression will work for both VB and Python.
0 Kudos