HOW TO

Ersetzen von mehrfach vorhandenem Text in einer einzigen Zeichenfolge mit einem Arcade-Ausdruck in ArcGIS Online Map Viewer

Last Published: December 6, 2023

Zusammenfassung

In ArcGIS Online Map Viewer, descriptive details of features within a map are displayed through pop-ups. Pop-ups can display attachments, charts, images, texts, and links to external web pages. In some cases, the pop-up display includes special character strings in each field and these characters must be replaced. The task of replacing these fields is simpler with Arcade expressions.

This article provides instructions to replace multiple text or special characters in a single string using Arcade expressions in ArcGIS Online Map Viewer.

Vorgehensweise

  1. Open the map in Map Viewer. Click Layers, and select the <layer name> with the pop-up for editing.
The Map Viewer Contents toolbar with the Layers tab
  1. Click Configure pop-ups > Manage expressions.
The Map Viewer Pop-ups pane used to navigate to the Map Viewer Pop-up expressions pane
  1. Click + Add expression to open the Arcade Expression dialog box.
The Map Viewer Pop-up expressions pane with the Add expression icon
  1. Configure the Arcade expression using the variables assigned with the Replace() function to identify the multiple text or characters, and replace them with the desired text in the field. The sample Arcade expression below replaces the special characters or symbols in the Notes field of the feature layer.
var str=Replace($feature.Notes, '&', 'and') //Replace & to spell and
var str1=Replace(str, '#', 'No.') // Replace # with the word No. 
var str2=Replace(str1, '\ ', ' ') // Replace \ with a blank space
Replace(str2, '/', ' ') // Final replacement to return the result
  1. Rename the expression. In this example, the expression is named Notes to match the selected field name. Click OK.
The Map Viewer Arcade expression dialog box to define expressions and rename the expression
  1. Click the previous button The previous arrow icon to return to the Pop-ups pane.
The Map Viewer Pop-up expressions pane with the newly added expression
  1. Click Fields list to expand the list of fields currently displayed in the pop-ups, and click Select fields.
The Map Viewer Pop-ups pane displaying the location of the Fields list section
  1. Uncheck the Notes field without the Arcade expression, and check the Notes field with the Arcade expression. Click Done.
The Map Viewer Select fields pane to select fields to be displayed in the pop-up

The image below shows the pop-up of the standard Notes field.

The Map Viewer pop-up without the Arcade expression for the Notes field

The image below shows the pop-up of the Notes field with the Arcade expression.

The Map Viewer pop-up with the Arcade expression for the Notes field

Artikel-ID:000026849

Benachrichtigungen erhalten und Lösungen für neue oder häufige Probleme finden

Unser neuer KI-Chatbot stellt zusammengefasste Antworten und Videolösungen für Sie bereit.

Esri Support App herunterladen

Zugehörige Informationen

Weitere Informationen zu diesem Thema erkunden

Unterstützung durch ArcGIS-Experten anfordern

An den technischen Support wenden

Esri Support App herunterladen

Zu Download-Optionen wechseln