Auto-generating AssetID using Arcade expressions

224
0
02-25-2024 08:50 PM
Labels (1)
RalphWebster
New Contributor

Hi all, I'm trying to create a Smart Form in AGOL that auto populates an AssetID with the help of Arcade Expressions.

I've had a good look around the Esri forums and was wondering whether there is a way to auto generate an AssetID for a point layer in Field Maps, as my current calculated expression does not auto populate the AssetID in the fields map app? Could this be a problem because I deleted some test points that I created in ArcGIS Pro after I pushed it up onto AGOL from ArcGIS Pro that led to the expression not being able to auto populate?

Current Arcade expression in the field maps Smart Form is listed below for reference:

var FS = FeatureSetByName($map,"Fence Switch",['Category'])
var no = Max($layer, 'OBJECTID');
var sumFS = no + 9001
var total = "FS_" + sumFS

if (IsEmpty($feature.Electric_Fence_Switch_AssetID)) {
    return "FS_9001";
} else {
    return $feature.Electric_Fence_Switch_AssetID;
}
 
and the attribute table of the layer contains:
  • ObjectID
  • Electric_Fence_Switch_AssetID
  • Category
  • Paddock Name
  • GlobalID
  • Fence_Switch_Status

Thanks!

0 Kudos
0 Replies