HOW TO
In ArcGIS Online and Portal for ArcGIS, associated information can be recorded in the fields of hosted feature layers. To ensure efficient data analysis, it is sometimes necessary to check that cells are not empty and each contains a value. The Arcade expression provided in this article can be used to return the count of non-empty cells across fields for records in a hosted feature layer.
Four fields are used in this example to calculate the count of non-empty cells. Cells of certain records are empty, while others contain values equal to or greater than zero.
var reportCount = 0 if($feature["<fieldName"] != null) { reportCount += 1 } if($feature["<fieldName"] != null) { reportCount += 1 } //add more fields as required return reportCount
This is the Arcade expression used in this example.
var reportCount = 0 if($feature["Morning_TrafficReport"] != null) { reportCount += 1 } if($feature["Midday_TrafficReport"] != null) { reportCount += 1 } if($feature["Evening_TrafficReport"] != null) { reportCount += 1 } if($feature["Night_TrafficReport"] != null) { reportCount += 1 } return reportCount
After running the Arcade expression, the output is generated in the new field. In this example, the only record with four non-empty cells is the record associated with Tun Razak Rd. where the output shows '4', matching the number of fields calculated.
Get help from ArcGIS experts
Download the Esri Support App