Skip to main content

Questions tagged [error-000358]

000358 : Invalid expression, an ESRI software error code, returned when a SQL expression is invalid.

Filter by
Sorted by
Tagged with
0 votes
0 answers
71 views

arcpy.SelectLayerByAttribute_management

I have a scripts that was created some time ago, probably in an earlier version of Python. I have several Python programs to use and get different error. I guess that's to be expected. Code snippet: ...
FSR's user avatar
  • 1
0 votes
0 answers
42 views

Formatting SelectLayerByAttribute_management where clause

I have two shapefile layers in my arcMAP project, "TP_Input" and "union". The latter has the associated layer "unionOutputLyr". I am trying to do a simple select by ...
William's user avatar
  • 171
0 votes
2 answers
74 views

Selecting records after using insert cursor

Using ArcPy and on the same script, I would like to perform a SelectLayerByAttribute tool to select the features created with the InsertCursor tool. coords = [1, 2, 3, 4] pointlyr = 'point' Sr = ...
user206005's user avatar
0 votes
1 answer
228 views

ERROR 000358: Invalid expression when using SelectLayerByAtrribute

I'm trying to finish a script that select a polygon attribute by location using the arcpy call. Here is my code: project = arcpy.GetParameter(0) proj_layer = r'memory/' + str('proj') arcpy....
Live Strong's user avatar
3 votes
2 answers
295 views

File Geodatabase SQL expression to get greatest 1 per group

I have a RoadInsp FC in a FGDB in ArcGIS Pro 2.6.8. Using an SQL expression in the Select by Attributes tool, I want to select the greatest 1 per group. In other words, for a given ASSET_ID, I want ...
User1974's user avatar
  • 1,282
0 votes
0 answers
53 views

ESRI - ERROR 000358: Invalid expression. Connect Public Transit Data Model To Streets

Having some issues running the Connect Public Transit Data Model To Streets (Public Transit) tool with arcpy. Getting an error code when completing a script provided by Esri - located here. I modeled ...
MattMDL's user avatar
  • 21
1 vote
0 answers
24 views

ArcPy select by attribute fails with invalid syntax error message [duplicate]

I am trying to use ArcPy with ArcGIS Pro v 2.8 to select by attribute from two different attributes in a shapefile. My code fails with a ERROR 000358: Invalid expression. I have used ModelBuilder to ...
GBG's user avatar
  • 10.5k
0 votes
1 answer
77 views

Creating where_clause in ArcPy gives ERROR 000358

I would like to create a query in ArcPy without creating a temporary additional attribute first. Unfortunately I fail with the syntax for creating the expression. I want to check if a ratio of two ...
Uli Smellfooth's user avatar
0 votes
1 answer
158 views

Creating new feature classes from tuple using ArcPy

I have point Feature Class that includes 49 OID. After that I have a Tuple that includes random set of OID from point feature class for example new_OID = ('10,24,38,41', '17,26,34,47', '5,7,18,25', '7,...
Mohammad hassan moayyedian's user avatar
0 votes
2 answers
629 views

Select layer by attribute based on multiple field attribute values in a list

I have a list of street_names ['SH-701', 'SH-67', ' ABC', 'Dharampur Road', 'Kailash Road', 'Tithal Road', 'SH-6', 'Halar Road', 'SH-183', 'Ramji Tekra Road', 'Mahatma Gandhi Road', 'Bandar Road', 'M ...
soumik chakraborty's user avatar
1 vote
1 answer
475 views

ERROR 000358: Invalid expression Failed to execute (MakeFeatureLayer)

I have the code below import arcpy, os from arcpy.sa import * arcpy.env.overwriteOutput = True fc = r'E:\dada proj\DRAW OBJECTS\VIPPoints.mdb\FINALDATA' # Point feature class, needs to be in a ...
user181566's user avatar
1 vote
1 answer
451 views

ArcPy Select by attribute using create date

I'm writting a Python script that will look for newly created features and update them. This script will be automated to run every day at the end of the day. I'm using the Select by attribute tool to ...
Omega's user avatar
  • 335
0 votes
1 answer
88 views

Select Layer by Attribute clause fails

I have a shapefile and I want to loop through every column and extract selected features with the specified criteria (Column has a P or L). So my code is like output = "All.shp" fields = ...
GeoF's user avatar
  • 391
1 vote
1 answer
1k views

Escaping single quotes for an SQL query in ArcPy

I have some data with strings containing single quotes (') and can't figure out a way to pass that string into an SQL query in arcpy.analysis.Select(). The SQL query running on a feature class in a ...
Ruslan's user avatar
  • 695
0 votes
1 answer
946 views

ArcPy - Select by Attribute for string doesn't work

I am developing a Python script, in which I want to select features based on an attribute, which is a string. I tried for hours and used a hundred different ways, but I always get the Error 000358 ...
GIS_USAr's user avatar
3 votes
1 answer
6k views

A column was specified that does not exist error - ArcGIS

I have some code that ran just fine on ArcMap 10.7 in May, but is now giving me an error when trying to create a new shapefile. The join that precedes the code that throws an error succeeds, and when ...
Shawn Schreier's user avatar
0 votes
0 answers
95 views

expression for "SelectLayerByAttribute_management" with value of a cursor

I am currently struggling with the correct syntax for a SelectLayerByAttribute_management query, which is created iteratively by a cursor. I want to intersect each municipality from a polygon file ...
Kunibert's user avatar
0 votes
1 answer
1k views

Using "IN" within where clause of arcpy.MakeFeatureLayer_management

I am using ArcGIS Pro 2.4.0, with Python 3.6.8. I found the following similar posts but could not figure out how to apply them: Using Python Search Cursor results to Select Features by Attributes and ...
ENIAC-6's user avatar
  • 916
1 vote
2 answers
185 views

Difficulty with select by attributes using list fields in for loop

I am trying to add fields to a table and then populate the fields with text values (Yes/No). The text values are based on whether or not a species was found in a specific block. If the species was ...
Winn's user avatar
  • 11
1 vote
2 answers
1k views

ArcPy Select Layer by Attribute for Date and Time

I have a list of trips with a field, "Trip Start Timestamp" thats type is date where it appears on the attribute table as M/D/YYYY HH:MM:SS AM/PM I need group all trips with the same trip start ...
Lena B.'s user avatar
  • 11
1 vote
1 answer
81 views

Creating an SQL expression and writing/reading it to/from a file

I'm working on a way to take the number for projects that are marked as active in a spreadsheet and put that into a SQL expression that I can use to select from. So far I've got this dirname = os....
Starjames77's user avatar
0 votes
1 answer
86 views

Heatmap script gives ERROR 000358 from SQL expression using ArcPy with ArcMap

I have a heatmap script that will eventually print 10 PDF maps. At the moment it is failing at the SQL expression in the Make Feature Layer right before Kernel Density Raster creation because the ...
Anthony Stokes's user avatar
0 votes
1 answer
1k views

Writing where_clause to Select Layer By Attribute for Python Add-in?

I have an add-in script for a toolbox in ArcMap that lets a user select a data frame, a layer within it, a field from the layer, an operator (= , > , <, etc.), and a value from the field. I'm ...
andm's user avatar
  • 41
1 vote
0 answers
124 views

Executing Select Layer By Attribute in Python Add-in Toolbar (ArcMap)

I'm having trouble with the button class of my code: class OKButton(object): """Implementation for ok.button (Button)""" def __init__(self): self.enabled = True self.checked = False def ...
andm's user avatar
  • 41
0 votes
1 answer
218 views

Select By Attribute - Get Parameter as Text - User input SQL ArcPy

I am trying to create a script that will search for suitable site locations. I want to let the user input an area size (e.g. >20) to be searched but each time I run the script it comes up as Error ...
sammy's user avatar
  • 1
0 votes
2 answers
160 views

ArcGIS 10.5 Python toolbox problem SelectLayerByAttributeERROR 000358: Invalid expression Failed to execute

I am trying to create a .pyt that find and select an object in an specific layer but I have a problem. I'm working on the Desktop version 10.5 and actually the code is this one: def getParameterInfo(...
vinjazz's user avatar
1 vote
1 answer
177 views

Select by attribute with field equal to element of vector in ArcPy?

I am trying to select by an attribute with a condition that field equals to an element of a vector. I use a for loop but could not get the right expression for this condition. Here are my codes. ...
Zhenyu's user avatar
  • 73
1 vote
0 answers
54 views

Using ArcPy to select polygons one by one and export them? [closed]

I want to select polygons in a (double field type) and export them, and I keep getting this error: ExecuteError: ERROR 000358: Invalid expression "dobule" = '1' Failed to execute (Select). This ...
Luis Medina's user avatar
0 votes
0 answers
246 views

Select Analysis Invalid Expression

I am attempting to select nulls from an in_memory feature layer using Arcpy's Select_analysis. Code example below, as well as, various iterations of attempts to alter the SQL query with no success. ...
MapPeddler's user avatar
0 votes
0 answers
109 views

Selecting values with date-format by using SelectLayerByAttribute_management with input Parameter

I am working on a Tool which selects records depending on the input value. Works fine, till I want to select date-records. I used def buildWhereClause(self, table, field, value): # Add DBMS-...
Andreas's user avatar
  • 69
2 votes
2 answers
553 views

Selecting all values with <Null> by using SelectLayerByAttribute_management with input Parameter

I am trying to select all values with Null by using the SelectLayerByAttribute_management. But the Fieldname in the where-clause is alterable by using the input-parameter. That is what i tried: if ...
Andreas's user avatar
  • 69
1 vote
1 answer
221 views

SelectLayerByAttribute_management searching with different datatypes

I am trying to use the SelectLayerByAttribute_management in a tool. The tool works like that: The User puts in the Feature which Layer should be selected by attribute -> "inputFeature". Then he ...
Andreas's user avatar
  • 69
1 vote
1 answer
496 views

arcpy SelectLayerByAttribute_management runs in the Python window in ArcGIS Pro, but fails to run from Spyder or PyCharm

I have this script for querying a feature layer and then copying to a geodatabase. It works when I run it in the ArcGIS Pro Python window, but not when I run it from Spyder or PyCharm. When I run in ...
KirkyLady's user avatar
1 vote
2 answers
155 views

Where Clause in SelectLayerByAttribute function resulting in invalid expression

All of the attempts below result in ERROR 000358: Invalid expression Any ideas on what I am doing wrong? I am working within a File GDB and with polygons. Attempt 1: def SelectLayer(val): print ...
reevesii's user avatar
  • 1,529
0 votes
1 answer
256 views

Select_analysis in ArcPy gives ERROR 000358?

Trying to learn how to use Select_analysis but the queries cause the ERROR 000358: Invalid expression. Piece of code: arcpy.Select_analysis(in_features='test1', out_feature_class=...
user130347's user avatar
0 votes
1 answer
176 views

Syntax error in Where Clause using .format in arcpy.Select_analysis

I'm having a little trouble understanding the syntax for a Where Clause; e.g., for use in arcpy.Select_analysis(inSHP, clipSHP, where). input is polygon shapefile; Zone_ID field is short integer ...
a11's user avatar
  • 950
1 vote
3 answers
437 views

Invalid expression with string/text

I'm trying to use ArcPy and Python more since the ability to just point and click isn't that marketable. I've been using ArcPy for Select by Attribute. It works fine when I try to select attribute ...
Bowen Liu's user avatar
  • 663
0 votes
1 answer
1k views

ERROR 000358 When trying to select by attribute using "IS NULL" query

I am trying to select a layer by attribute (field is null) using a stand alone python script. #Select layer by attribute to find any null values arcpy.AddFieldDelimiters(mayIntLyr, "...
T.Law's user avatar
  • 31
3 votes
3 answers
574 views

SQL Query Syntax gives ERROR 000358: Invalid expression?

I'm writing a script that will cycle through a shapefile of building footprints for an entire state, create a folder for the individual counties in that state, and then intersect the building ...
Chase Green's user avatar
0 votes
1 answer
109 views

Subset a shapefile that excludes certain field values by using NOT in Select by Attribute where clause

I am using ArcPy 2.7 to subset a shapefile. I am trying to use arcpy.Select_analysis to exclude certain features from a shapefile (idle fields denoted as 1401 in the field 'Crop_Type'. my 'Crop_Type' ...
ENIAC-6's user avatar
  • 916
1 vote
2 answers
357 views

Why is SelectLayerByAttribute_management claiming "Column Does Not Exist"?

The solution to this question is not working for me. My error message: File "SumAreas.py", line 24, in arcpy.SelectLayerByAttribute_management(fc, "NEW_SELECTION, '"CLASS_CODE" = "A"') File "...
Waterman's user avatar
  • 1,217
2 votes
2 answers
1k views

ERROR 000358: Invalid expression Failed to execute (Select Layer By Attribute)

I'm using ModelBuilder to extract a layer by field values. I'm working on this field : I tried this method from Extracting by Attribute Using ModelBuilder with User Input? and it worked for many ...
Sefiane's user avatar
  • 35
7 votes
1 answer
1k views

arcpy.SelectLayerByAttribute not working with an integer saved in a variable

I have a long code written and this is the last little bit I need and for whichever reason it does not work. This is the simple code. k=2 arcpy.SelectLayerByAttribute_management("poligon", "...
valsten's user avatar
  • 73
-1 votes
1 answer
160 views

SQL query new feature within definition within loop of cursor

I am using ArcGIS 10.4.1.5686 and running code within ArcMap. I thought that this question is similar to SQL query new feature with loop, or even Using a for loop to execute a query in arcpy, but ...
Alexander Audet's user avatar
1 vote
2 answers
310 views

Create and populate field with name of feature (Select by Location) ArcPy

I am staring at 5600 individual points and 60 polygons. I need to create a new field in the point fc called 'Basin Name' and populate the field with the name of the Basin that it lies in. I am trying ...
Wazzy24's user avatar
  • 89
2 votes
1 answer
526 views

arcpy.MakeFeatureLayer_management: query throws error 000230/000358 [duplicate]

Im trying to create a feature layer on which i want to perform a select by location, however: arcpy.MakeFeatureLayer_management (perp, "selected","LINK_ID = 23002109") throws: ExecuteError: ERROR ...
maxwhere's user avatar
  • 1,158
0 votes
1 answer
468 views

Using Select by Attribute expression in ArcPy?

I have tried multiple ways to create an expression for use in the Select by Attribute tool, however it does not work past OID 3. For some reason, all the expressions work for OID 1 and OID 2, however ...
MacroZED's user avatar
  • 2,291
2 votes
1 answer
733 views

Compare two fields not equal to each other in a join from a feature layer

I am wanting to find features not equal to each other in a feature layer in Python, and I am not finding the right SQL to use. The two features are joined to each other on a MasterID field. When using ...
user avatar
1 vote
0 answers
96 views

Error 00358 when using arcpy.SelectLayerByAttributeManagement [duplicate]

All I'm trying to do is use SelectLayerByAttribute to select all lines less than 5.1 meters. However, no matter what query I try I keep getting "error 000358 invalid expression" when I run the script ...
Rdubya54's user avatar
0 votes
0 answers
112 views

Formating a query in ArcPy- why the error?

I have the following Select Layer By Attribute statement throwing a 000358 invalid expression error using Python with ArcGIS 10.4. The input feature layer is valid because I can select features using ...
GBG's user avatar
  • 10.5k