HOW TO
In ArcGIS Pro, Arcade expressions with multiple statements can be used to split and reposition text strings of a field within a pop-up. The repositioned text strings can be used for data management or search results optimization. This article provides an example and instructions using Arcade expressions to split and rearrange text strings within a pop-up for ArcGIS Pro.
The image below shows a pop-up with the Property Name field and the text string records.
var <variableName1> = Split($feature.<featureName>, ' ')
var <variableName2> = Count(<variableName1>)
If(<variableName2> == 0) { return '' }
If(<variableName2> == 1) { return $feature.<featureName> }
If(<variableName2> == 2) { return <variableName1>[1] + ' ' + <variableName1>[0] }
If(<variableName2> == 3) { return <variableName1>[1] + ' ' + <variableName1>[2] + ' ' + <variableName1>[0] }
If(<variableName2> == 4) { return <variableName1>[2] + ' ' + <variableName1>[3] + ' ' + <variableName1>[0] + ' ' + <variableName1>[1] }
The code block below shows the full working expression.
var arrName = Split($feature.PROP_NAME, ' ') var lenName = Count(arrName) If(lenName == 0) { return '' } If(lenName == 1) { return $feature.PROP_NAME } If(lenName == 2) { return arrName[1] + ' ' + arrName[0] } If(lenName == 3) { return arrName[1] + ' ' + arrName[2] + ' ' + arrName[0] } If(lenName == 4) { return arrName[2] + ' ' + arrName[3] + ' ' + arrName[0] + ' ' + arrName[1] }
The newly configured pop-up below displays the reordered text strings.
Get help from ArcGIS experts
Download the Esri Support App