Select to view content in your preferred language

How to create NextSequenceValue Id Attribute Rules for FGDB using Arcade

301
2
01-18-2025 08:59 AM
Labels (3)
jayaramBirudukota
New Contributor

How to generate the NextSequenceValue  numbers using Arcade expression in FGDM not in EGDM(enterprise geo database).

Please suggest any way how to create the attribute rules using Arcade in FGDB

0 Kudos
2 Replies
LyonMNGIS
Frequent Contributor
Hello,
I attached code from the Address Management Solution that uses sequence values. Someone can correct me if I am wrong but you don't create a sequence value using Arcade. Instead you can use a sequence value that has already been created in your FGDB. The "Create Database Sequence" tool. Will allow you to create a new sequence with a starting id and increment value. Once you run the tool then you can use Arcade to get the sequence.
I hope that helps.

Reference: https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-database-sequence.htm
// This rule will create a new unique id when an address point is created
//Trigger: insert

// Define the id field
var id_field = "addressptid";

// If the feature id is not blank or null return
If (!HasKey($feature, id_field)) return;
var id = $feature[id_field];
If (!IsEmpty(id)) return;

// Define the name of the database sequence and the format for the id
// Text on either side of the ${ ... } will be added to the id
id = `ADD-${NextSequenceValue("AddressPointID")}`;

// Return the new id
return {
"result": {
"attributes": Dictionary(id_field, id)
}
}

0 Kudos
SSWoodward
Esri Contributor

In recent releases of ArcGIS Pro, we have begun rolling out python tools that will assist users in creating attribute rules for common tasks. In ArcGIS Pro 3.4 we released the Generate ID Attribute Rule GP Tool. This tool will author an attribute rule that generates a customizable ID for features in any workspace that supports attribute rules. 

Check it out and let us know what you think. 

0 Kudos