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
5
votes
2answers
395 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), ...
5
votes
2answers
139 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 ...
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 ...
4
votes
1answer
122 views

Writing query in “Select_analysis” to compare string from one column with another column?

I have a shp file (s.shp) with column "A" and column "B". I try copy from this file only that rows where string value from column "A" is part of string value from column "B" e.g. A 0.1 0.2 0.3 ...
3
votes
1answer
474 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", "...
3
votes
3answers
4k views

Runtime error : ERROR 000358: Invalid expression using SelectLayerByAttribute in ArcPy?

I cannot for the life of me persuade SelectLayerByAttribute to work (I need to automate this for a complex script). Working in ArcMap's python console on already loaded shapefile, the format below: ...
3
votes
3answers
123 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 ...
3
votes
1answer
597 views

ArcPy inconsistently accepts SQL queries for MakeFeatureLayer or SelectLayerByAttribute

I need to buffer a subset of features in a particular feature class. To do this, I am first creating a feature layer (using a SQL query to select only what I want), and then running Buffer. So my ...
3
votes
1answer
990 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 ...
2
votes
3answers
261 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
88 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 ...
2
votes
2answers
77 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 ...
2
votes
1answer
169 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 ...
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....
2
votes
2answers
1k views

Why can't I use SelectLayerByAttribute_management while a cursor is set

I've been having a problem with arcpy in that the simple line: arcpy.SelectLayerByAttribute_management ("TEMP_LINES") produces this response: Runtime error : ERROR 000358: Invalid expression Failed ...
2
votes
2answers
662 views

Trying to use an integer in a WHERE clause

I'm trying to use an integer value in a WHERE clause (looking at an integer field). expression = "'SERVICE' = 'Service' " expression = expression + 'AND ' expression = expression + "'GPS_TIME_TOTAL' &...
2
votes
1answer
257 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 ...
2
votes
1answer
546 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 [...
2
votes
1answer
77 views

Parameter to script tool gives Invalid expression ERROR 000358?

I have created python script tool in arcgis 10.1 as below. I am trying to take input parameter and passing to select statement. There is error when i execute this tool. import arcpy from arcpy ...
2
votes
2answers
284 views

Error 000358 or Error 999999 invalid SQL

i've been searching arround all the answers in the questions of Error 358 and beyond, but i doesn't fix my problems, i tried every post and so on the problems stills there. I make two options in my ...
1
vote
3answers
95 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 ...
1
vote
4answers
333 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
188 views

Debugging ERROR 000358: Invalid expression from SelectLayerByAttribute? [duplicate]

I'm creating a script tool and using the SelectLayerBy Attribute function (below), arcpy.SelectLayerByAttribute_management("cities_lyr", "NEW_SELECTION", '"CRIME_INDX" <= 0.02') However, I keep ...
1
vote
2answers
61 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 ...
1
vote
1answer
227 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 ...
1
vote
1answer
177 views

SQL within Python Script to get only part of the expression by GetParameterAsText

I was wondering if anybody could help me. Im trying to create a tool within ArcMap using a python script. Within the script i've been trying figure out how to change it so that I only need to get ...
1
vote
1answer
1k views

Debugging Select By Attribute tool within loop giving ERROR 000358: Invalid expression Cannot acquire a lock?

I have seen several similar posts related to this technique but I am still having issues. The following script is intended to select all points from one shapefile that are within the boundaries of a ...
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. ...
1
vote
1answer
147 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, ...
1
vote
2answers
80 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 ...
1
vote
1answer
217 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 = ...
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)\...
1
vote
1answer
432 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 ...
1
vote
1answer
318 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 ...
1
vote
1answer
407 views

Referencing Selection in SQL query (where clause) with ArcPy?

I keep raising errors with my where_clause in the 9th line of this script. FID is an Object ID field and I want the cursor to select whatever row it is currently pointing at. I don't know how to do ...
1
vote
1answer
248 views

Formatting SQL expressions for ArcPy with ArcSDE for PostgreSQL feature class?

I'm trying to use SelectLayerByAttribute to find the last point added to a FC. I figured I could use the objectid field because it's serial. I wrote the following: arcpy....
1
vote
1answer
71 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 ...
1
vote
1answer
161 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
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
795 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', '...
1
vote
2answers
97 views

Getting number as parameter to use in SQL expression leads to ExecuteError: ERROR 000358?

In my script I am using the Select tool (arcpy.Select_analysis) and in the SQL expression, I want to use a number that I call in as a parameter. I have trying to script it like: subsize = arcpy....
1
vote
1answer
220 views

ERROR 000358: Invalid expression “Parcelles_class.OBJECTID” = 1 OR “output_table1.src_OBJECTID” = 1 Failed to execute (Select)

I'm executing this code. I don't know if i'm missing something, I'm using Arcpy, Python, Arcgis 10.1 whereclause1 = '"Parcelles_class.OBJECTID" = 1' whereclause2 = '"output_table1.src_OBJECTID" = ...
1
vote
0answers
27 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 ...
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 ...
1
vote
2answers
417 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 ...
1
vote
0answers
55 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
2answers
176 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 "...
0
votes
1answer
443 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, ...
0
votes
1answer
82 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
2answers
8k views

What causes ExecuteError: ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute) on shapefile? [duplicate]

My script runs perfectly for feature classes, but not shapefiles. It crashes at the point of selection, provided there is a query. gp.Workspace = "C:/someworkspace" fc = "featureclass.shp" query = "[...