HOW TO
In ArcGIS Pro, Arcade expressions can be used to identify specific fields with similar field names. The identified fields can be used for further calculations. This article provides an example and instructions using Arcade expressions to return the fields containing a string for further calculation in pop-ups for ArcGIS Pro.
The field values from the following fields (2006 Ratio of Female to Male in Primary Education, 2007 Ratio of Female to Male in Primary Education, 2008 Ratio of Female to Male in Primary Education, and 2009 Ratio of Female to Male in Primary Education) are identified to calculate the minimum and maximum values.
The image below shows a standard pop-up without the minimum and maximum values.
var <variableName> = []; var <variableName1> = []; var <variableName2> = Schema($feature)['fields'];
for (var i in <variableName2>){ var <variableName3> = <variableName2>[i] var <variableName4> = <variableName3>['name'] if (Mid(<variableName4>, 5, 1) == '0'){ Push(fields,<variableName4>) Push(<variableName1>, $feature[<variableName4>]) } }
return max(<variableName1>)
The code below shows the full working script.
var fields = []; var values = []; var all_fields = Schema($feature)['fields']; for (var i in all_fields){ var field_dict = all_fields[i] var x = field_dict['name'] if (Mid(x, 5, 1) == '0'){ Push(fields,x) Push(values, $feature[x]) } } return max(values)
The image below shows the minimum and maximum values in the pop-up after using the Arcade expression.
Get help from ArcGIS experts
Download the Esri Support App