Select to view content in your preferred language

Unable to create or update points in Sign Management solution

471
1
01-08-2026 07:56 AM
DCWade
by
Occasional Contributor

We are in the final stages of deploying the Sign Management solution to our organization and are running into an issue with creating/editing points in Field Maps. As part of the solution there is an Arcade expression to calculate asset id's using wildcards and sequential values. We have made no changes to the Arcade expression from the solution, and it works perfectly fine using the Sign Editor Web Experience.

However, when trying to create/edit points in Field Maps the asset id field is flagging as "Failed to calculate" and will not let points be submitted. This asset id field is not a required field so I am not sure why it is preventing field staff from collecting points, even if there is an issue with the expression? The arcade expression is included below:

var layerIndex = '1'
var idField = 'assetid'
var idPrefix = 'SIGN-'
var digits = 6

/*DO NOT CHANGE ANYTHING BELOW THIS LINE
-------------------------------------------------------------------------*/

function GenerateWildcards(digits, wildcard) {
  var wildcards = ''
  for (var i=0; i < digits; i++) {
    wildcards += wildcard
  }
  return wildcards
}

function GetNextId(layerIndex, idField, idPrefix, padding, sqlFilter) {
  // get the feature with the greatest assetid that matches the id pattern specified in the SQL statement.
  var assetid_features = Filter(FeatureSetById($datastore, layerIndex, [idField], false), sqlFilter)
  var max_assetid_feature = First(OrderBy(assetid_features, `${idField} DESC`))  

  // If no features match the pattern the featureset will be null, return the first assetid
  if(max_assetid_feature == null) {  
    return `${idPrefix}${Right(padding, Count(padding)-1)}1`
  }

  // when features do match the pattern calculate and return the next assetid  
  var max_assetid = max_assetid_feature[idField]
 
  var next_assetid_number = Number(Replace(max_assetid, idPrefix, "")) + 1
  return `${idPrefix}${Text(next_assetid_number, padding)}`
}

// Define the edit context so the value is only calculated when the feature is created
if ($editContext.editType == "INSERT") {
  // return matching prefix pattern and get next value
  var wildcards = GenerateWildcards(digits, '_')
  var padding =  GenerateWildcards(digits, '0')
  if (idPrefix != '') {
    var sqlFilter = `${idField} LIKE '${idPrefix}${wildcards}' AND ${idField} NOT LIKE '%[^0-9]'`    
    GetNextId(layerIndex, idField, idPrefix, padding, sqlFilter)
  }

// return number id's only and get next value
  else {
    var sqlFilter = `${idField} NOT LIKE '%[^0-9.]%'`    
    GetNextId(idPrefix, padding, sqlFilter)
  }

}
else {
  return $feature[idField]
}
0 Kudos
1 Reply
Andrew_Eaton
Esri Contributor

There is a syntax error in the final else statement in the arcade expression, In the latest update Field Maps introduced more rigorous checks for syntax errors which is why this issue is cropping up now.  It's a quick fix.  

Replace the code on line 47 with:
        GetNextId(layerIndex, idField, idPrefix, padding, sqlFilter)

image.png

This syntax error has been corrected in the solutions app so any new deployments will have the correct code.  

Let me know if you have any issues.

0 Kudos