Using Select By Attributes in Model Builder

4403
16
Jump to solution
04-12-2018 08:43 AM
JohnMcConalogue
New Contributor III

I am trying to use Select by Attributes within model builder. The input layer is a feature layer that is created.

My model fails on the Select By Attribute step with an error message saying that the specified field can not be found. This is the field that I have specified in the input layer.

Anyone know why this is? 

0 Kudos
16 Replies
JohnMcConalogue
New Contributor III

Why...I sent the error message

0 Kudos
XanderBakker
Esri Esteemed Contributor

Knowing how things are connected and understanding how things are connected helps understanding what is happening and could be causing the error. Guessing what might be the problem will not be very effective in order to solve the problem. 

0 Kudos
JohnMcConalogue
New Contributor III

I am attempting to carry out the Select by Attributes on Layer(2) but I get the error message above.

0 Kudos
XanderBakker
Esri Esteemed Contributor

I don't see any parameters defined, so I guess that the names are kinda "hard coded" in the model which should not cause the field "ExcelToTable12_Features.Townlands" not te be found in the select by attributes. In case you want to have a physical result, without the temporal join you could use Join Field—Help | ArcGIS Desktop instead (in case the join is by attributes) or use Feature Class to Feature Class—Help | ArcGIS Desktop after the join to create a new featureclass with the additional fields. 

0 Kudos
curtvprice
MVP Esteemed Contributor

Add Join can be a challenge in Model Builder because you need to explicitly remove the join before you run it again or it gets confused.

I'm with Xander, I'd simplify things by copying the output of select layer by location with Copy Features to a temp dataset (in in_memory if not too big) and use Join Field to add the data directly from the output from Excel To Table. Oh, and I'd run Excel To Table to a geodatabase temp table  instead of a dbf. (No need to make an XY event layer if you are just going to add the fields to another table which already has locations.)

Joins work better when both tables have an ObjectID field, external data sources like .xlsx and .dbf do not have objectID fields, so joins won't have as much functionality (and run slower). Best to import the data to Esri world (in_memory, temp geodatabase table) before doing joins, so you get the benefit of the OID field.

JohnMcConalogue
New Contributor III

How would I import into a temp geo-database before querying the tables?

0 Kudos
XanderBakker
Esri Esteemed Contributor

One of the options as Curtis Price suggests is using the Copy Features—Help | ArcGIS Desktop tool. As for the output you can use "IN_MEMORY" as output workspace and ArcGIS will know that it needs to create the output in memory. See also Using in-memory workspace—Help | ArcGIS Desktop 

View solution in original post