cabel_napsg

Arcade: Default allOccurrences Boolean in "Replace" Function Can Cause Problems

Discussion created by cabel_napsg on Feb 4, 2019

 

I noticed the following behavior when using Arcade in ArcGIS Online.

 

I added some expressions to configure a pop-up in an AGOL map. After some work, I realized that if I selected one of the points on my map, the entire web page would freeze. Eventually my web-browser would show a "Page Unresponsive" message and encourage me to exit the page.

 

After some testing, it appears I had accidentally prompted an infinite loop when using one of the functions. I had included a Replace function in which I was trying to replace "Flood" with "Flooding". By default, that function attempts to replace all occurrences of the text. I thought that meant all occurrences in the original value--but apparently I prompted an infinite loop. Setting the "All Occurrences" Boolean to false solved the issue.

 

From what I've seen:

  • This behavior exists even if the expression is not included in the pop-up contents.
  • This behavior only occurs if a point is selected that executes the expression. (E.g., If I try to replace "Flood" with "Flooding," I will not see the error if I choose a point that does not include the term "Flood")

Outcomes