Select to view content in your preferred language

How to create NextSequenceValue Id Attribute Rules for FGDB using Arcade

118
1
3 weeks ago
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
1 Reply
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