Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [error-000358]

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

1
vote
0answers
25 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 ...
0
votes
0answers
34 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. ...
0
votes
0answers
21 views

Incorrect SQL syntax [duplicate]

I'm trying to execute the following code and it throws me an error. value=u'L_PARCEL_A' where_clause="'LAYER'='{0}'".format(str(value)) arcpy.Select_analysis("input_lu1",stat_feature,where_clause) ...
0
votes
0answers
18 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-...
2
votes
2answers
53 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 ...
1
vote
1answer
43 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 ...
0
votes
1answer
47 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 ...
1
vote
2answers
53 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 ...
0
votes
1answer
51 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=...
0
votes
1answer
38 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 ...
1
vote
3answers
76 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 ...
0
votes
2answers
102 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, "...
3
votes
3answers
97 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 ...
0
votes
1answer
29 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' ...
0
votes
2answers
99 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 "...
1
vote
2answers
278 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 ...
3
votes
1answer
342 views

arcpy Select Layer By Attribute 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", "...
-1
votes
1answer
62 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 ...
0
votes
2answers
76 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 ...
2
votes
1answer
196 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 ...
0
votes
1answer
118 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 ...
2
votes
1answer
129 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 ...
1
vote
0answers
40 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 ...
0
votes
0answers
63 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 ...
1
vote
2answers
104 views

arcpy.Select_management invalid sql expression - VDI

I am using ArcMap 10.2.2 and trying to make separate feature classes from a larger feature class using a field delimiter and SQL statement but am getting an error that the SQL statement is invalid. ...
0
votes
2answers
60 views

What's wrong with my expression?

I'm trying to have a user input a county in my tool, and then use that string to select from a layer of counties. County = arcpy.GetParameterAsText(0) #Select county to clip arcpy....
0
votes
1answer
345 views

Using list of numbers to Select By Attribute in ArcPy?

I am trying to use Python to select all records whose attribute (which is a number) in a certain field is within a list. I cannot get the syntax correct. my list is: upstream = [9841978, 9842008, ...
1
vote
4answers
232 views

Unsupported Operand Type for Field Query

Following on from Correct SQL expression for SelectbyAttribute Tool, I have my code: import arcpy plantFile = r"U:\Users\K\Plants.shp" field = "UID" arcpy.MakeFeatureLayer_management (plantFile, "...
1
vote
1answer
139 views

Use SearchCursor to populate SQL query from a table to run a selection on a feature class

I have a feature class with three fields of interest EV_CODE (text), TREE_SIZE_CODE (text) and CANOPY_COVER (number). I needed to find all possible combinations of those three attributes within the ...
1
vote
1answer
109 views

Debugging ArcPy ERROR 000358: Invalid expression?

I've tried several iterations of this SQL statement in a stand alone script: QF5 = "Week" QF6 = "Wk" RV3 = "" WC4 = """" {} <> {} AND {} <> '{}' """.format(QF5,QF6,QF6, ...
5
votes
2answers
122 views

Calculating max and average distance from point to points in ModelBuilder?

I have two point layers. One contains nest locations and the ID of the individual using that nest. The second point layer contains movement points for all individuals in the area. I would like my ...
1
vote
2answers
64 views

Error 000358 with SelectLayerByAttribute_managment

I get this error when 'arcpy.SelectLayerByAttribute_management' statement is executed. I tried many different ways to format my whereclause. I had printed it and it looks fine. But the error still ...
2
votes
3answers
241 views

Using “IN” for SQL statement in Python

I'm selecting all records and then removing certain values from this selection in a Python script. I've succeeded using a for loop in a SearchCursor to remove records from the selection but it is very ...
2
votes
1answer
83 views

Using a Variable in arcpy.SelectLayerByAttribute

I know this is a very basic problem I should be able to solve myself, but I've had no luck. I have a variable I want to use in the query for arcpy.SelectLayerByAttribute, but the line that was working ...
3
votes
1answer
908 views

Iterate through features of a feature class and buffer them?

I'm currently trying to iterate through the features of a feature class (using an update cursor, because the goal is to ultimately update the field) and buffer each individual segment. I eventually ...
0
votes
2answers
100 views

Arcpy select more than one record

I'm working with ArcGIS 10.2. I used this code to select one record of an attribute table: import arcpy # Set the workspace env.workspace = "F:ArcGIS\Trab\Model\Lin_150_tr.shp" # Make a layer from ...
0
votes
4answers
78 views

using where clause for selecting more than one value in the field in arcpy.Select_analysis

I have a problem in using the Select_analysis or Select by attribute, what I need t do, is to extract all the residential uses from a land use feature class, and make a feature class for residential, ...
1
vote
1answer
174 views

Arcpy MakeFeatureLayer_management issue using SQL condition

I have a lines shapefile. I made a small code to select some of its elements and turn them into a standalone layer. The code is like this: arcpy.env.workspace = r"C:\MyDirectory\Mygdb.gdb" network = ...
5
votes
2answers
346 views

SQL MAX Subquery in arcpy.MakeFeatureLayer_management

I am having an issue with subsequent subqueries in making a feature layer in arcpy. My table has fields: OBJECTID, pointid (long), grid_code (double) I can successfully extract MAX(grid_code), ...
1
vote
1answer
196 views

Pass sql expression with GetParameterAsText to SelectLayerbyAttribute in .py script

With Arctoolbox and python scripting I'm creating long tool, but one of the steps is to select by attributes with SQL expression. Let's imagine that: featureCar = arcpy.GetParameterAsText(0) is Data ...
2
votes
1answer
2k views

Using variable in Arcpy select analysis

I need to use arcpy.Select_analysis() in my arcpy script, but I have problem with using variables. When I use hard coded values in where_clause, it is working. where_clause = '"Area" > 20' arcpy....
1
vote
1answer
1k views

Invalid Expression ERROR 000358: Select by Attribute

I'm attempting to select a certain point in a feature layer so I can perform buffer analysis on it. The code seems fine, but I am getting an invalid expression error: File "C:\Program Files (x86)\...
4
votes
2answers
2k views

Using Python to select records by date field

I am trying to write a python script to select records created within the past 7 hours (date field - database time) using a where-clause within arcpy. The table is ArcSDE database (Microsoft SQL ...
1
vote
1answer
33 views

Error 000358 using SelectLayerByAttribut_management using escape characters

I am trying to use arcpy.SelectLayerByAttribut_management using the following code: def filterData(self): self.filterBuilder() arcpy.MakeFeatureLayer_management (r"%s\tempclipprefilter"%self....
1
vote
1answer
717 views

ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute)

My python script in ArcMap has an initial dialog box with two inputs: REG_CODE (values are in a list and include 'AKR', 'IMR', 'NER', etc) and Selection_type which offers 'NEW_SELECTION', '...
0
votes
1answer
138 views

Using variable in SelectByAttribute_management [duplicate]

I am new in Python. I was trying to use a variable for selecting a feature instead of giving a direct input. My code sample will explain it better: import arcpy from arcpy import env env....
-1
votes
1answer
65 views

Error: 000358 Failed to execute (SelectLayerByAttribute) halfway through the script

Its strange that the script would start and work on some data, but then fails more than half way through. Here is the error message and relevant script (error line 229 in bold) line 229, ...
1
vote
1answer
391 views

Invalid expression error 000358 when using in_memory workspace? [duplicate]

Make Feature Layer with an SQL Selection Expression against a geometry property like length fails when the source feature class is in an in_memory workspace. An otherwise identical model works just ...
2
votes
1answer
480 views

Using Search Cursor to calculate fields with records having a specific value

I'm a total beginner at programming and Python. I'm trying to select features by attributes and then field calculate in another field. In VBA it might look like this: If [Z1COMM] = "R" then [...
1
vote
1answer
306 views

ExecuteError: ERROR 000358 - Using a variable within arcpy.Select_analysis() [duplicate]

I have looked at Including variable in where clause of arcpy.Select_analysis()? and while it is very similar to the question I'm asking I ran into the same issue after implementing its syntax. I feel ...