I want to create unique asset nr using Arcade expression to display the numbers and letters from domain field and a sequence number
for example
Road_type → CR
Location → 01
Sublocation → 22
CR0122-0001
CR0117-0002
CR0251-0003
Solved! Go to Solution.
Create a database sequence: Create Database Sequence (Data Management)—ArcGIS Pro | Documentation
Use this expression in the attribute rule:
// Calculation Attribute Rule for the ID field
// triggers: Insert, Update
// Exclude from application evaluation
// If there is already a value in the ID field, return that
if(!IsEmpty($feature.AssetNumber)) {
return $feature.AssetNumber
}
// get all the parts for the unique id, format them correctly
var parts = [
$feature.RoadType,
Text($feature.Location, "00"),
Text($feature.Sublocation, "00"),
"-",
Text(NextSequenceValue("NameOfTheSequence"), "0000")
]
// concatenate and return
return Concatenate(parts, "")
Create a database sequence: Create Database Sequence (Data Management)—ArcGIS Pro | Documentation
Use this expression in the attribute rule:
// Calculation Attribute Rule for the ID field
// triggers: Insert, Update
// Exclude from application evaluation
// If there is already a value in the ID field, return that
if(!IsEmpty($feature.AssetNumber)) {
return $feature.AssetNumber
}
// get all the parts for the unique id, format them correctly
var parts = [
$feature.RoadType,
Text($feature.Location, "00"),
Text($feature.Sublocation, "00"),
"-",
Text(NextSequenceValue("NameOfTheSequence"), "0000")
]
// concatenate and return
return Concatenate(parts, "")
Thanks, Johanes