Select to view content in your preferred language

Iterator values start at 1?

3785
23
03-02-2011 07:59 AM
TomBonnot
Deactivated User
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
ChristopherDeRolph
Occasional Contributor
I am experiencing this same issue.  Anyone have an answer for this yet?

Thanks!

Chris
0 Kudos
BBicking1
Esri Contributor
I am experiencing this same issue.  Anyone have an answer for this yet?

Thanks!

Chris



Hi Tom,

Please attach your model with a small sample of your data.

Barbara Bicking
Geoprocessing Team
0 Kudos
GabeMarcello
Emerging Contributor
Same issue here.

I have 17 division names in a string field [Division].

I have 'Iterate Field Values' iterator with SQL Expression selected as data type. I want the model to take each unique value in [Division] and use it in the next tool 'Select Layer By Attribute' as the expression [Division]='%'

I could be wrong, but Isn't this how SQL Expression in this iterator is supposed to work?

I also tried an inline variable in my 'Select Layer By Attribute' expression: [Division]='%Value%' and set the Iterator data type back to string. The selection came out: [Division]='1'. When really it should be something like [Division]='Lakeshore'

I get the same generic Value=1 for every different type of field in my feature class, no matter if it is string, long, short, float, double, etc. Even if the iterator is outputting the number of iterations instead of the actual value it should still show me the number of unique values (in the case of [Division], 17) instead of 1. But I thought the iterator was supposed to output the actual unique value of the field specified?
0 Kudos
BBicking1
Esri Contributor
Same issue here.

I have 17 division names in a string field [Division].

I have 'Iterate Field Values' iterator with SQL Expression selected as data type. I want the model to take each unique value in [Division] and use it in the next tool 'Select Layer By Attribute' as the expression [Division]='%'

I could be wrong, but Isn't this how SQL Expression in this iterator is supposed to work?

I also tried an inline variable in my 'Select Layer By Attribute' expression: [Division]='%Value%' and set the Iterator data type back to string. The selection came out: [Division]='1'. When really it should be something like [Division]='Lakeshore'

I get the same generic Value=1 for every different type of field in my feature class, no matter if it is string, long, short, float, double, etc. Even if the iterator is outputting the number of iterations instead of the actual value it should still show me the number of unique values (in the case of [Division], 17) instead of 1. But I thought the iterator was supposed to output the actual unique value of the field specified?



Hi Gabe,

without having a copy of your model, I can't tell why you get what you get.

Barbara
0 Kudos
GabeMarcello
Emerging Contributor
Hi Gabe,

without having a copy of your model, I can't tell why you get what you get.

Barbara


Will this attachment suffice?
0 Kudos
BBicking1
Esri Contributor
Will this attachment suffice?



Hi Gabe,

Thanks so attaching the model.
Your first Select Layer by Attribute uses the output, i.e., Value from Iterate Field Values, yet the iterator has not yet run.

Also, do you intend to iterate every process every time the iterator outputs another Value?

Barbara Bicking
0 Kudos
GabeMarcello
Emerging Contributor
Hi Gabe,

Thanks so attaching the model.
Your first Select Layer by Attribute uses the output, i.e., Value from Iterate Field Values, yet the iterator has not yet run.

Also, do you intend to iterate every process every time the iterator outputs another Value?

Barbara Bicking


Barbara,

I guess I don't understand. I want the entire model to run each time the Iterator selects a new unique value in the specified feature class field. Where does the iterator have to be placed in the model for it to run?
0 Kudos
MarkWheeler
Deactivated User
Was there ever a resolution to this issue?

I've got the exact same problem. No matter what the data type of the field, the resulting value of VALUE is 1.  I have an input table with a 'Usercode' field of string values. According to Help, the iteration should select every unique value in the "Usercode' and pass that string value on.
0 Kudos
GabeMarcello
Emerging Contributor
Was there ever a resolution to this issue?

I've got the exact same problem. No matter what the data type of the field, the resulting value of VALUE is 1.  I have an input table with a 'Usercode' field of string values. According to Help, the iteration should select every unique value in the "Usercode' and pass that string value on.


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!
0 Kudos