Select to view content in your preferred language

calculate field in ArcGIS Online

538
2
02-06-2024 12:37 PM
RobertCottreau
Emerging Contributor

I know how to calculate field in Online but how can I calculate a field only for null rows in a column not for all rows.

I don't want to have to export back into Pro and do this.

 

Thank to all.

Tags (3)
0 Kudos
2 Replies
MobiusSnake
MVP Regular Contributor

Assuming you're working from the Data tab of an Item page in AGOL, the SQL coalesce function might do what you're looking for.  It accepts multiple arguments and returns the first non-null argument.  For example, if you have a field named Label where some records have labels (and you want to keep those) but you want to use 'Feature (objectid)' for those with null values, you could do something like this:

coalesce(LABEL, CONCAT('Feature ', OBJECTID))

Anything with a label will get the first value (the existing value) and anything that's null will get "Feature #".

I would recommend testing this on some data that you don't mind messing up first however, like a temporary field added for this purpose.

AdrianWelsh
MVP Honored Contributor

Robert, instead of using the data tab, like mentioned above (though, that might be easier), you can bring in your ArcGIS Online data into Pro without having to export and then re-publish. All you need to do is either add data from path from the add data button:

AdrianWelsh_0-1707253121133.png

 

Or, just go to your portal in your catalog pane and find the data that way. Then you can edit the data just as you would in pro with a file geodatabase feature class (and the data in AGOL will update as you edit it).

AdrianWelsh_1-1707253205243.png