I am working with Field Maps in ArcGIS Online and creating an expression on a form to populate a field with the next value. The issue I am having is trying to sort a field in a hosted feature layer descending that has a string format of ‘SS-20’.When I sort the field it returns ‘SS-9’ as the highest value instead of ‘SS-20’. I am trying to create an expression to take the highest value in a field and then calculate the next value when a new feature is added. The formula below works if there is a beginning value of ‘SS-1’ but will not work once it reaches ‘SS-10’. The result is ‘SS-9’. Is there a way to sort a string field which contains numbers as if it was a integer field? var exist_assetID = $feature.AssetID //Grab the highest number asset id var streetsign = Top(OrderBy((FeatureSetByName($map, "Traffic Signs ", ['AssetID'], false)), 'AssetID DESC'), 1) //(Result above is SS-9) Need it to be SS-20 //Calculate the last assetID + 1 for (var ss in streetsign) var max_assetID = Number(Right(ss.AssetID, 1))+1 //Street Sign is tagged as SS-1 var new_assetID = Concatenate("SS-", max_assetID, '') //If the unit id exists, pass the value. if not, pass the last value+1 iif(isEmpty($feature.AssetID), new_assetID, $feature.AssetID)
... View more