Scheduled ModelBuilder task fails on Select Layer By Attribute using Hosted Feature Layers (Error 000358 Invalid Expression)

2473
15
02-10-2022 07:21 AM
Labels (2)
DataOfficer
Occasional Contributor III

I have a ModelBuilder process which carries out the following (diagram attached):

  1. Uses a hosted feature layer containing site boundary polygons (Layer1) as an input to a Select Layer By Attribute tool
  2. This uses a simple SQL expression to select rows in Layer1 meeting certain criteria
  3. The Select Layer By Location tool uses a second hosted feature layer containing polygons (Layer2) as input features, and selects them based on an Intersect relationship with the Layer1 features selected in step 2.
  4. The Calculate Field tool is used to overwrite text in a field of the selected rows in Layer2

When run 'in person' in ArcGIS Pro, the model runs without issue. However, it fails when run as a Scheduled Task, giving the following error:

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

The error help page is not particularly useful in this instance. Any ideas?

0 Kudos
15 Replies
Robert_LeClair
Esri Notable Contributor

This is BUG-000131693 - Select Layer By Attributes fails with ERROR 000358 or ERROR 000732 when scheduled in ArcGIS Pro.  It is fixed at ArcGIS Pro 3.0.  There is no current workaround in ArcGIS 2.9.x unfortunately.

Michael_VanHatten
New Contributor III

Has there been any progress with this bug? Do we have to wait until 3.0 for automatic geoprocessing? It seems like this should be low hanging fruit.

Robert_LeClair
Esri Notable Contributor

Michael - BUG-000131693 was fixed at ArcGIS Pro 3.0...which should be released very, very soon I suspect with User Conference coming up next month.  Esri tends to release software updates a few weeks before UC.

Michael_VanHatten
New Contributor III

Thanks Robert

0 Kudos
DataOfficer
Occasional Contributor III

Is there a timeline for the 3.0 release?
Is it possible instead to export the models to Python and schedule those instead?

Thanks,
Rob

0 Kudos
Robert_LeClair
Esri Notable Contributor

I don't know when 3.0 will be released as I'm not on the ArcGIS Pro Dev Team (I'm in Training Services).  You can export a model to a Python script and use Windows Task Scheduler to run the Python script.  There's a blog article that describes the workflow here

0 Kudos
RyanBohan
Occasional Contributor III

This has been driving me nuts all morning.  My model works just fine, if I manually click run, if I schedule it, it fails.  I tracked it down to the same error 000358.  

I'll check out the process to export to a python script, thanks for the tip

I found this youtube very helpful, if you already know models skip about 30 minutes in.  https://www.youtube.com/watch?v=pIfS0saxpi8

Michael_VanHatten
New Contributor III

Were you able to find a solution to this issue? I have a nearly identical model and I am getting the same error (Error 00358: Invalid expression) My model works great when I start it, does not work when scheduled. Very annoying 

Ramon_de_Leon
Occasional Contributor

Have the same issue using the "Select (Analysis)" tool on a scheduled model.... This is the workaround that kinda help me get it to work.

I've notice that the issue only happens when the SQL expression is referring to a numerical field... In my case I needed to select data that are greater than 0 (I'd imagine it would be more complicated if it is another threshold value or ranges), so what I did was:

  • create a new string field
  • calculate the value of the created field as text value of the field I wanted to do my integer based expression

Ramon_de_Leon_0-1652905546000.png

 

  • • Do the "Select (Analysis)" tool with the expression using the text field:

Ramon_de_Leon_1-1652905562599.png

 

 

Hopefully the bug gets fixed soon, it’s a lot of extra steps to get the select working on a scheduled tool.

0 Kudos