Using Select By Attributes in Model Builder

4657
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
1 Solution

Accepted Solutions
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

16 Replies
DanPatterson_Retired
MVP Esteemed Contributor

The field you refer to... where is it and what is its name?  Is it the actual field name or an alias.

Perhaps the whole error message would help

JohnMcConalogue
New Contributor III

Here is the error message:

Start Time: Fri Apr 13 09:35:03 2018
ERROR 000358: Invalid expression
An expected Field was not found or could not be retrieved properly. ExcelToTable12_Features.Townlands]
Item not found in this collection.
Failed to execute (Select Layer By Attribute).
Failed at Fri Apr 13 09:35:03 2018 (Elapsed Time: 0.01 seconds)

Townlands is the field name within the feature layer

0 Kudos
XanderBakker
Esri Esteemed Contributor

Is there a join involved in the process?

JohnMcConalogue
New Contributor III

There is a join involved and I suspect that is the problem. The field I am querying "townlands" is from another table from a join.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Save the joined file to a new one as part of the process first... you can always delete at the end

JohnMcConalogue
New Contributor III

I converted the feature kayer to an excel spreadsheet and then converted the excel spreadsheet to a .dbf. I can do a select on the .dbf and get the record im querying for.

Is there a simpler way to do this?

0 Kudos
XanderBakker
Esri Esteemed Contributor

If the idea is to select by attributes, you can do this directly on the feature layer. No need to export to Excel and export from Excel to dbf.

JohnMcConalogue
New Contributor III

Yes but the Select By Attributes is throwing the above error message if I do it on the feature layer.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Can you share a screenshot of your model?

0 Kudos