1

I am using the ModelBuilder to run an iterative process using the "for" iterator. The entire process is about 7 steps that are iterated several times, depending on the input to the tool (to value, from value, By value). The final two steps involve adding a field and copying the result of a previous step into this field (so that the iterative process does not write over the previous results). The tool works fine except for the last iteration. Regardless of how many iterations it runs, in the last iteration is does everything except copy the field over to the new field. It does complete the step of adding a field, but the copying over of the values from the result field doesn't take place in the very last iteration (works fine for all other iterations).

Any idea why this would happen?

The field shows up with values "0". The exception is that if the last iteration happens at a value that is less than the maximum value (the "to value") then the iteration is fine: so if I use input like: from:1 to:103 by:10 then I will get a complete last cycle at 101. But if I define from:1, to:101 by:10. The field defined at iteration 101 is populated by the value "0". enter image description here

  • Could you post a screenshot of your model? – Keagan Allan Mar 25 '18 at 4:41
  • So it runs as is, just doesn't finish the final step of copying the data into the last field? – Keagan Allan Mar 25 '18 at 4:56
  • Right! - but only when the last cycle is at the exact value of the "To Value". If the last cycle is slightly lower than the to value is does run the entire cycle. and for the other cycles it always completes the entire set of tasks – Rebecca Mar 25 '18 at 5:16
  • If you check the data, are there values in the fields that are being copied. Specifically that last 0 value. Silly question but sometimes the model runs as intended it's just the information that is wrong. – Keagan Allan Mar 25 '18 at 5:39
  • Yes, the "calculate field" step is really just copying the data from a different field that is updated everytime the "Near" step is iterated. It's copied so that the next iteration will not write on it. I've tested to make sure that the last iteration does go through the "Near" step and some values are changed. But nothing is copied over. – Rebecca Mar 25 '18 at 5:59
1

AS I mentioned in my comment, that after checking the same Model as yours and check different iteration values, a different expression for the field calculator. That everything works perfectly.

So I suggest in this case, that the error is a system error (maybe restart ArcMap or restart windows) will help. Also checking field calculator manually will be a good idea to define if the error is caused by the iteration process or not.

Here, I would add. In such a same case, it would be better to add in the Model the tool (STOP), this tool helps to recognize at which iteration value can an error produced.

enter image description here

  • 1
    Yes, Thank you! Restarting helped. I should have checked for that before starting this thread. – Rebecca Mar 25 '18 at 20:43

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.