HOW TO

Use Arcade expression to configure the text formatting for pop-ups in Map Viewer Classic

Last Published: August 10, 2022

Summary

In Portal for ArcGIS Map Viewer Classic, Arcade expressions and HTML tags can be used to format the text displayed in a pop-up according to the specifications applied. This article provides an example and instructions using the Arcade expressions and HTML tags to configure the text formatting for pop-ups in Portal for ArcGIS Map Viewer Classic.

Procedure

The workflow below utilizes the Arcade functions and HTML tags listed in the table below to configure the text formatting for pop-ups in Portal for ArcGIS Map Viewer Classic:

Arcade Function or HTML TagAttribute Result
Proper(inputText, applyToText)Transforms a text value to title case.
Left(value, charCount)Returns the specified number of characters from the start of a text value.
IIf(condition, trueValue, falseValue)Returns a given value if a conditional expression evaluates to true, and returns an alternate value if that condition evaluates to false.
Concatenate(inputText, value)Concatenates values and returns a text value.
if(fieldValue condition numberValue)
return "colorCodeNumber"
Assigns a color code number based on criteria.
<font color='#{expression}' style=''>{fieldValue}</font>Applies color to the text.
<b>"text"</b>Bolds the text.
<em>"text"</em>Italicizes the text.
<u>"text"</u>Underlines the text.
  1. Log in to Portal for ArcGIS and open the map in Map Viewer Classic.
  2. Click Details, and click Content.
  3. Click More Options The More Option icon next to the layer next to the layer, and click Configure Pop-up.
The Configure Pop-up option in the Contents pane
  1. Scroll down to the Attribute Expressions section in the Configure Pop-up pane, and click ADD.
The ADD icon under the Attribute Expressions section in the Configure Pop-up pane
  1. In the Expression window, configure the following parameters for each of the Arcade expression:
    1. Specify a name for the new expression as required.
    2. Specify the following Arcade expression in the Expression dialog box:
  • The Arcade expression to capitalize the beginning of every word.
Proper($feature.<fieldName>, 'everyword')
  • The Arcade expression to replace a blank field value with 'Unknown'.
var t = Left($feature.<fieldName>, <characterNumber>)
var u = $feature.<fieldName>

IIf(t == " ", "Unknown", u)
  • The Arcade expression to assign colors based on three conditions.
if($feature.<fieldName> < <numericValue>){
    return "<colorCode>"
}
if($feature.<fieldName> >= <numericValue> && $feature.<fieldName> < <numericValue2>){
    return "<colorCode2>"
}
if($feature.<fieldName> >= <numericValue2> && $feature.<fieldName> <= <numericValue3>){
    return "<colorCode3>"
}
  • The Arcade expression to concatenate two texts when a condition is met.
var <variableName> = $feature.<fieldName>
var <variableName2> = Concatenate($feature.<fieldName2>, " <fieldValue>")
var <variableName3> = Concatenate($feature.<fieldName2>, " <fieldValue2>")

When(
ST == '<variableName2>', <variableName2>,
ST == '<variableName3>', <variableName3>)
  1. Click OK.
Specifying the Arcade expression in the Arcade expression dialog box and providing a name for the Arcade expression
  1. Under the Pop-up Contents section in the Configure Pop-up pane, for Display, click A custom attribute display from the drop-down menu.
  2. Click CONFIGURE to open the Custom Attribute Display dialog box.
Changing the pop-up display option and click Configure to edit the pop-up further in the Configure Pop-up pane
  1. Click the View HTML Source button to switch the view to HTML Source.
  2. In the Custom Attribute Display dialog box, include the HTML tags as required, and click OK.
  3. Click OK in the Configure Pop-up pane to apply the pop-up configuration.
Specifying the HTML tags in the Custom Attribute Display dialog box

The image below shows the configured pop-up whereby parts of the text are bold, italicized, underlined, and color-coded based on specific criteria.

The end result of the custom attribute display pop-up window

Article ID:000028044

Software:
  • ArcGIS Online
  • Portal for ArcGIS

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic