Hi!
I'm trying to create a calculated field with a running number for each registration of insects along a transect. Registrations are created as point features.
I wrote the script according to this solution https://community.esri.com/t5/arcgis-field-maps-questions/autonumbering-arcade-expression-works-in-t...
However, it does not work as expected.
In field maps on iphone the first registration for each transekt gets number 0 after that the running count works fine. On android every registration gets number 0 and the calculation is not workning and our field staff is using android.
if(!IsEmpty($feature.art_nr)) {
return $feature.art_nr
}
else {
var observationer = FeatureSetByName($map,"3_Fhin_Fjarilar_Artreg_2024",['art_nr'],false)
var transekt = $feature.transekt
var abo = $feature.abo
var arter = Filter(observationer, "(transekt = @transekt) AND (abo = @abo)")
var numarray = []
for (var n in arter){
var nn = Number(n.art_nr)
Push(numarray, nn)
}
var senaste_art_nr= Max(numarray)
var next_art_nr = senaste_art_nr + 1
return next_art_nr
}
Autonumbering works on android if I use only
var observationer = FeatureSetByName($map,"3_Fhin_Fjarilar_Artreg_2024",['art_nr'],false)
var transekt = $feature.transekt
var abo = $feature.abo
var arter = Filter(observationer, "(transekt = @transekt) AND (abo = @abo)")
var numarray = []
for (var n in arter){
var nn = Number(n.art_nr)
Push(numarray, nn)
}
var senaste_art_nr= Max(numarray)
var next_art_nr = senaste_art_nr + 1
return next_art_nr
Any ideas if it's a bug or a mistake in my code?