AnsweredAssumed Answered

Can AGO/Portal attribute expression be used to calculate a field?

Question asked by jakek on Mar 20, 2019

We have a feature layer in Portal map that I want to auto-populate a field.  Using utility type (W for water and S for sewer) with the ObjectID to calculate the field name PipeLocationID, so the result would look like "W-123".  This is the arcade exp for a custom field for the pop-up in the map: return Left($feature.PipeAssetType, 1) + "-" + $feature.OBJECTID  where PipeAssetType = "Water" or "Sewer" in a pick list.  My goal is to have no typing for the field crews collecting the data with iPads, so we would like to have a unique ID auto-populated.  I previously set this up with an attribute rule in Pro (with some hiccups), but was thinking there may be a better way using a custom expression in Portal. Any ideas if this can be done?

 

Steps to get there:  Open AGO/Portal map, click layer in TOC ..., configure pop-up, under Attribute Expressions click Add to create a new custom expression, enter code above.  Tried: $feature.PipeUniqueID = return Left($feature.PipeAssetType, 1) + "-" + text($feature.OBJECTID) , but does not calculate the field and returns "Parse Error:Line 5: Unexpected token return".  So I'm assuming it can't be done.

 

If there's no possible way, I will post to Arcgis Ideas.

Outcomes