Select to view content in your preferred language

Arcade expression error - sequential number generator

730
11
Jump to solution
06-27-2024 09:32 AM
dsinha
by
Occasional Contributor

Hello,

I am trying to use the expression mentioned on this page to generate the next number in a field that stores the record number of observations collected in the field. The field idlong is an integer field and is located in the hosted feature layer DataCollectionInspection.

Here is my version of the arcade expression:

var numberlist = FeatureSetByName($map,"DataCollectionInspection")
var topnum = Top(OrderBy(numberlist,'<idlong DESC'),1)
var counter = Number(Max(topnum,'idlong'))
var id = counter+1

return id
 
When I run it in the Arcade Editor, I get the following error message: Test execution error: Unknown Error. Verify test data.
 
Would anyone know what I am doing wrong?
 
Thanks!
 
Deb.
0 Kudos
11 Replies
dsinha
by
Occasional Contributor

Thank you so much @ChrisDunn1! I will try out these two versions. 

0 Kudos
dsinha
by
Occasional Contributor

Just wanted to report back that the first solution (using var numberlist = $layer$layer) worked!

Thanks again for all your help!

0 Kudos