Select to view content in your preferred language

Expression to calculate unique IDs in Arcade

01-21-2021 11:36 AM
Labels (2)
New Contributor II


I have created a feature layer in ArcGIS online to manage invasive plant species populations in our Parks, that I plan on using for detection/treatment tracking purposes and for field work using Field Maps. I was wondering if there is an expression to designate intentional unique identifiers to each population (feature). I have a park code for each, and a species code for each that I calculated in the attribute table using Arcade for all features.  I would like to combine these fields and also populate a number in sequence number by date. 

For example, at our Dam Site Park (DS) we have multiple Ailanthus altissima (AIAL) populations. I would like for to create a field expression that will assign unique identifiers: DS_AIAL_1, DS_AIAL_2, DS_AIAL_3, etc, with numbers in sequence ordered by Date Detected (see fields below).



I am new to using Arcade and would appreciate any insight on this. Thank you!


0 Kudos
2 Replies
New Contributor

Have the same issue here, Have you figured out??

0 Kudos
New Contributor

I'm wondering the same thing. I'm new to coding and arcade but if you use the distinct function it can find unique ID.

var id= $feature.unique_id

Distinct([id], 'Unique ID is unique')

return 'Check Unique ID'

I use that code to populate a field but I think I have my variables mixed up. All my fields are reading 'Check Unique ID" but I fixed it prior to calculating that field.

0 Kudos