Select to view content in your preferred language

Iterator values start at 1?

3590
23
03-02-2011 07:59 AM
TomBonnot
New Contributor
Hi,
I have been trying to use an iterate field value tool in my models.  Each iteration I want to use the value in an SQL expression.  But the first value returned from the iterator is always a "1", which is not in my field values at all.  Because there is no 1, the tool using the expression always crashes.  Why does the iterator generically start with 1 and not my first field value?

Thanks,
Tom
0 Kudos
23 Replies
BBicking1
Esri Contributor
I stumbled upon the solution when I decided to just let my model run to see what happened. Apparently, the first iteration used the value '1' and all my selections were empty because of this. After the model finished for the value '1' it started to iterate through the actual values. Worked perfectly!



Hi Gabe,

you can eliminate the initial run by constructing your model such that the iterator is the first process to run, thus it gets initiallized to the value you want.
As I said above, now your first process runs and the iterator hasn't done anything and therefore it uses the default value 1.
I asked if you want to iterate the entire model because of where you placed the iterator in the model, yet wanted the output from the iterator used in your model's first process.

Barbara Bicking
0 Kudos
JordanChamberlin
New Contributor
you can eliminate the initial run by constructing your model such that the iterator is the first process to run, thus it gets initiallized to the value you want.


HOW do you do this, please?

Thanks!
0 Kudos
HeatherCarlos
New Contributor III
Hello,
I'm having a similar problem, but I have the precondition set.  I'm using Iterate Field Values and then I use the output as in-line variable substitution in Get Field Value.  However, Get Field Value won't run because the default of the Iterator is 1 and I get the error "Field 1 does not exist within table".

You can see in the attachment, Get Field Value is "not ready-to-run" - even once I run the iterator (and the iterator is no longer 1), the state of Get Field Value doesn't change and therefore it doesn't run.  I can manually trick it into Ready to Run state (by running the iterator and then opening, editing, cancelling the edit and closing Get Field Value), but since the iterator has already run, that doesn't help and once I reset it, it turns white.
0 Kudos
ShitijMehta
Esri Regular Contributor
HI HCarlos,

Couple of things need some clarification in your model.

1. This is what Get Field Value tool does - The Get Field Value tool gets the value of the first row of a table for the specified field.

2. Why are you iterating over field values using an iterator? This is what Iterate Field Value iterator does - Iterates over each value in a field. So you are iterating over a field value row by row.

3. How and Why are you using the output of the iterator which is the value of the field in the get field value tool? Get Field Value tool will only get the value of a first row of a field. So how are you using the output of the iterator as inline variable substitution?

4. What do you want to do through this model?
0 Kudos
CarelKotze
New Contributor II

I was wondering if anyone has figured out a work around for this issue. I am running into the exact same problem.

A simple model - Iterate field value (Name)- use the string output value to run a Make Feature Layer (Name =%Value%)

It will run and immediately stop with the error message Name = 1 does not exist. Examining the model after it ran, it shows that the Value output for Iterate field value now equals 1 even though that value does not exist in the data.

I even tried running the Iterate field value by itself after this happen and it gave me the same result Value = 1. 

A this point I closed everything down, opened it back up, ran the same model with no changes and it worked, once, and then went back the Value = 1 issue. 

Any help with this would be appreciated.

Thanks 

0 Kudos
ShitijMehta
Esri Regular Contributor

Hi, Carel Kotze

  • Is it possible to share your model and your data sample?
  • The default output of the iterator is 1 because, before it has run there is no way to know what the value will be. Especially when you are making generic models with undefined variable values or data types there is no way to connect the output of the iterator to the downstream tools if it has absolutely no information.
  • If I could see the model snapshot with the tool dialog of the tools both iterator and the Make Feature Layer that would help solve this. I am wondering if the SQL expression parameter is somehow set to a value of 1.

Thanks!

Shitij

0 Kudos
CarelKotze
New Contributor II

Here's an image of the model, table and parameters.

What bothers me is the inconsistency of the model, it will run fine one moment and then switch to the problem I have mentioned above, without me changing anything.

The way I managed to make the model work the last time is to change the Input value from the drop down option (the layer is in my table of contents) to the hard drive location using the browse button.

That fixed the problem without me having to change anything else in the model.

0 Kudos
CarelKotze
New Contributor II

The image

0 Kudos
ShitijMehta
Esri Regular Contributor

What you are describing is an inconsistent behavior and a bug with reading a layer, unfortunately i am unable to reproduce it with the current version. Which ArcMap version do you have?

0 Kudos
CarelKotze
New Contributor II

I am using ArcGIS 10.5.1

0 Kudos