Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
After relooking at my model, I think I inadvertently asked the wrong question, but still learnt something new anyway. –  Arabella May 15 '12 at 6:45

2 Answers 2

up vote 8 down vote accepted

You can use Model Builder variables.

Read more info here.

share|improve this answer
    
Example 4 on that page is exactly what you're looking for. –  nmpeterson May 14 '12 at 13:58
    
Yes that is what I had in mind. Thank you! –  Arabella May 15 '12 at 6:24

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.

share|improve this answer
    
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. –  Arabella 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. –  RyanDalton May 15 '12 at 14:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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