I'm totally struggling with a model build in ArcGIS 10.3.

Here’s what I’d like to do.

Take a table (analysis_table). Iterate over the rows in the table by a unique grouping identifier. From each row, use the values of two different fields, which are geoids, and select shapefiles from a separate database by those geoids. Create a new merged shapefile based on the two different shapefiles from the step immediately prior.

Here’s what happens:

I am able to parse out the value of two different variables within the row. This appears in the model as get field value (2) and get field value (3). These values are then fed into “select layer by attribute”, using a %value% expression.

Unfortunately though, select layer by attribute either has me make a new selection with each pass, or if I add to selection, it grows the selection continuously. In other words, rather than select a shapefile for each row in the iteration, it does one for each value that is passed from “I_analysis_table_OBJECTID”.

I want to merge the two shapefile outputs of “county_500k” (selected from my row iteration), save them out, then clear the selection for the next row pass, but I don’t know how or if that is possible.

screenshot of model build

You are right that I wasn't clear enough. I actually used different inline variable expressions for each Get Field Value, but I was getting sequentially more shapefiles added on with each row pass in the iterator. What I wanted was a new combined shapefile for each row pass of the iterator.

Today I took a different tact, and created sub-models to link each different attribute to each county, then bringing them back into the main model. I used a combination of "new selection" and "add to selection" in the select by attribute drop down options, which allowed each pass to start with a new selection, then add the sequential counties. You'll see that I added a third sub-model, but the syntax is essentially the same as the original problem I was trying to solve with two.

If it would be helpful to others, I can give more detail on the inline variable substitutions.

I'm including screenshots of the base model and one of the sub-models. Main model


1 Answer 1


You are using the wrong values in your Select Layer by Attribute.

Lets assume Get Field Value tools return GEOID's 11 and 22, these are stored in variables Value (2) and value (3) in your model. In your description above you state you are using %value% and value is the group by ID from the iterator.

It sounds like you want to change the whereclause (note you don't actually show us that important bit of information) in the Select Layer By Attribute to something like:

myGEOIDA = %Value (2)% AND myGEOIDB = %value (3)%

which would equate to:

myGEOIDA = 11 AND myGEOIDB = 22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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