I have created a simple model in ArcGIS 10 which, after some initial processing of a feature class, outputs outputfc and adds a field to it. Regardless of the feature class input (which the user specifies), the field newField that is added is always the same. I then need to do some calculations in this newly added field, but because I know this field will only have the name that I specified, I select outputfc as the input table for Calculate Field, and an input variable field with the name of the field newField as the value.

This works fine to achieve the outcome I want, but if I allowed the user to specify the name of the added field, how would I connect this to the next Calculate Field process?

  • After relooking at my model, I think I inadvertently asked the wrong question, but still learnt something new anyway. May 15 '12 at 6:45

You can use Model Builder variables.

Read more info here.

  • Example 4 on that page is exactly what you're looking for.
    – nmpeterson
    May 14 '12 at 13:58

Model Parameters are a little different than variables, but because you are connecting the Add Field to the output dataset, it is probably easiest to simply change the model input for the Add Field "name" inputbox into a "Model Parameter" (See Ref1 and Ref2).

From Ref 1 in ArcGIS Online Help:

To create a model parameter, you right-click a model variable and choose Model Parameter... Model parameters are shown with the letter P next to the variable. Now when the model tool dialog box is opened, you can change the [...] parameter to something else [...]. When you click OK, the tool will run using the data you provide.

  • I do have model parameters for the input and output feature classes, I just wanted to know if there was a different way to handle a variable field. Thank you for the input. May 15 '12 at 6:23
  • @Cindy, maybe I didn't communicate what I meant clearly. You can also set the Field Name as a model parameter. Right-click on the "Add Field" tool (in your model)-->Make Variable-->From Parameter-->Field Name. You can also allow the user to change things like Field Type & Length if you wanted to, but that gets risky because if you have a predetermined values (of say, TEXT) that you are calculating into the field, and the user chooses LONG INT, your model will fail to complete. May 15 '12 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.