laptop and a wrench

Bug

In ArcGIS Pro 3.1, when the user-defined function is declared within a loop in the Arcade script, it returns the following error message, "Invalid expression. Function declaration only at global scope".

Last Published: March 9, 2023 ArcGIS Pro
Bug ID Number BUG-000156393
SubmittedMarch 7, 2023
Last ModifiedJune 5, 2024
Applies toArcGIS Pro
Version found3.1
Operating SystemWindows OS
Operating System Version10.0 64 Bit
StatusAs Designed

Additional Information

Functions cannot be declared within a ‘for’ or ‘if’ statement. Declare the function outside the statement to use it.

Workaround

When the user-defined functions are declared outside the loop in the Arcade script, it works correctly with no issues in ArcGIS Pro 3.1.

Steps to Reproduce

Bug ID: BUG-000156393

Software:

  • ArcGIS Pro

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options