Automating Workflow (Arcade)

768
4
Jump to solution
09-02-2021 01:12 PM
Labels (1)
AlfredBaldenweck
MVP Regular Contributor

I'm looking at automating my workflow, the last step of which includes using an arcade expression to calculate a field. Basically Python's doing all the heavy lifting beforehand, and Arcade is being used to make the end result pretty.

Is it possible to automate an arcade expression like you would a python script?

If not, is there an easy way to run it, wrapped in a python script, from within the Model Builder?

Or do I have to rewrite it in Python?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

Is it possible to automate an arcade expression like you would a python script?

Depends. You can't execute an Arcade expression in certain intervals like you could with a Python script. But you can write Attribute Rules that automatically calculate your field.

 

If not, is there an easy way to run it, wrapped in a python script, from within the Model Builder?

You can use your Arcade expression in the Calculate Field tool.

 

Arcade is being used to make the end result pretty

If all you want to do with Arcade is to prettify things, you could also do that in the Popup.


Have a great day!
Johannes

View solution in original post

0 Kudos
4 Replies
JohannesLindner
MVP Frequent Contributor

Is it possible to automate an arcade expression like you would a python script?

Depends. You can't execute an Arcade expression in certain intervals like you could with a Python script. But you can write Attribute Rules that automatically calculate your field.

 

If not, is there an easy way to run it, wrapped in a python script, from within the Model Builder?

You can use your Arcade expression in the Calculate Field tool.

 

Arcade is being used to make the end result pretty

If all you want to do with Arcade is to prettify things, you could also do that in the Popup.


Have a great day!
Johannes
0 Kudos
AlfredBaldenweck
MVP Regular Contributor

I'm actually using it to calculate the field because using the same expression in hosted layer's popu makes the pop-up take 30 seconds-1 minute to load per feature, vs 30 seconds to calculate the field across the entire dataset all at once and have the information there permanently until the next update.

 

It looks like Calculate Field is going to be the perfect tool for this. I didn't realize it was able to be used in Model Builder.

Thanks!

0 Kudos
by Anonymous User
Not applicable

is it possible to store an Arcade expression in memory rather than having it write to an attribute table? I'm hoping to create a model that selects features that are marked as Complete and if they are older than 30 days (this would be my arcade expression - something like CompletedDate < DateAdd(Date(),-30,'days')) delete the points. 

0 Kudos
JohannesLindner
MVP Frequent Contributor

While you can delete features with Arcade, doing so in the Field Calculator is complicated.

If you want to build a model, you can do this easily with the available ArcGIS Tools:

JohannesLindner_0-1674201898265.png

In the Select Layer By Attribute tool, use this SQL expression (this works for a file gdb, you might need a different expression if you work in an enterprise gdb):

TextField = 'Completed' AND DateField < CURRENT_DATE() - 30

 


Have a great day!
Johannes