Until a more direct solution like push() is incorporated, you can still accomplish what you describe. I regularly use Arcade to build an array for popups and field calculations. When you call an established array of length n, assigning a value to the array at index n + 1 will append the value to the end of the array.
var arr_index = 0 var arr = [] arr[arr_index] = 'red' ++arr_index arr[arr_index] = 'yellow' ++arr_index arr[arr_index] = 'blue' return arr ---> ['red', 'yellow', 'blue']
Hi Josh,
That's really useful to know. I didn't know you could append to an array in that manner. I think this is more about me not knowing the intricacies of javascript!
Thanks for putting me on to this, I can certainly work with this technique.
Duncan
Arcade now has a Push function.
Good catch @KevinMayall
https://developers.arcgis.com/arcade/function-reference/data_functions/#push was added to Arcade at 1.12.
Thanks for the Push function tip - reduces/simplifies my code!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.