Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my model, I have a Calculate Field which will populate the field with a certain integer (in this case, 0). I've added an optional integer model parameter Start ID, where the user can specify the integer if they want.


If Start ID is given a value by the user, this value must be used as the expression for Calculate Field, else Expression must be used. Since the tool can only take one expression as an input, would I have to create a copy of the Calculate Field with Start ID as the expression, and use Merge Branch with an if statement to test which branch must run i.e. the Start ID branch only runs if it has a value, else run the Expression branch?

share|improve this question
up vote 3 down vote accepted

I think this can be done much more simply using a model like this:

enter image description here

where the If/Then logic is part of the Calculate Field tool:

enter image description here

Think of the newValue = 123 + 456 part being your Expression.

In my test this will calculate a field to be 479 (= 123 + 456) if nothing is entered by the user for Start ID (which is an Optional parameter) or whatever integer value they enter otherwise.

share|improve this answer
Simple and efficient answer. Thank you! – Cindy Williams-Jayakumar Oct 26 '12 at 8:35

Your Answer


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.