HOW TO
An Arcade expression can generate incremental IDs with a domain name prefix in the attribute table of a feature layer in the ArcGIS Enterprise portal and ArcGIS Online. This is useful for unique identification, as each record has a distinctive identifier to enhance the additional context of the data.
This article provides the workflow to generate incremental IDs with domain name prefixes using Arcade in the ArcGIS Enterprise portal and ArcGIS Online.
var baseID = { "DomainA": 1, "DomainAA": 2, "DomainB": 3, "DomainBB": 4 };
var domainName = $feature.<DomainName>;
if (HasKey(baseID, domainName)) { var currentBaseID = baseID[domainName];
baseID[domainName] = currentBaseID + 1;
var formattedID = Text(currentBaseID, '000'); return domainName + "_w_" + formattedID; } else { return domainName + "_w_" + "000"; }
The code block below shows an example of the full working script.
var baseID = { "DomainA": 1, "DomainAA": 2, "DomainB": 3, "DomainBB": 4 }; var domainName = $feature.DomainName; if (HasKey(baseID, domainName)) { var currentBaseID = baseID[domainName]; baseID[domainName] = currentBaseID + 1; var formattedID = Text(currentBaseID, '000'); return domainName + "_w_" + formattedID; } else { return domainName + "_w_" + "000"; }
The image below shows the incremental IDs with the domain name prefix generated in the attribute table.
Article ID: 000033269
Get help from ArcGIS experts
Download the Esri Support App