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
1answer
42 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 ...
1
vote
0answers
24 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 ...
0
votes
1answer
20 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 ...
0
votes
2answers
66 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(...
0
votes
1answer
39 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. ...
1
vote
0answers
38 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
57 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
22 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
26 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
76 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
65 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
93 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
57 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
77 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
45 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
93 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
241 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
122 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
31 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
167 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
405 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
460 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
75 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
102 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
249 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
138 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
157 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
54 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
76 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
113 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
64 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
420 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
323 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
159 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
143 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
135 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
77 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
258 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
87 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
978 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
105 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
81 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
209 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
388 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
226 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
3k 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
783 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', '...