Format text in title field of popup

283
3
03-01-2024 09:59 AM
Labels (1)
StephenKing3
New Contributor III

Hello,

I'm looking for a way to format the Title field of a pop-up in ArcGIS Online, both in terms of content and text formatting.

At the moment the Title area displays data from the field {name}. I would also like to pull in information from two additional fields, depending on whether the attribute field contains data for that particular record. I also want to put brackets around the values, but only want the brackets to display if the field contains data.

For example, the fields might be 'Name', 'Title', 'Alternate Title' and I would like it to display as:

Joe Blogs (Dr)

But if there is no title, then it would only display the name, e.g. Joe Blogs.

Hope that makes sense.

Thanks!

0 Kudos
3 Replies
BernSzukalski
Esri Frequent Contributor

Additional fields can be added by clicking the curly braces {} next to the title input.

BernSzukalski_0-1709317042247.png

Those can also be expressions.

You can use a combination of HTML, expressions, and fields to custom tailor the pop-up title. For example, this map uses HTML to increase the size and change the color of the title, which also includes an expression.

https://www.maps.arcgis.com/apps/mapviewer/index.html?webmap=ced283616b0844988f2a249aa78eda45

The title is configured as follows:

font face='verdana'><font size='4'><font color='0066cc'>{expression/expr0}</font></font></font>

I think if you experiment a bit with fields and expressions, you should be able to get the desired results.

bern

 

KenBuja
MVP Esteemed Contributor

You can do this by first creating a new Arcade expression that has the logic to add the title. Then in the Title configuration, click {}, then choose the expression.

 

if (!IsEmpty($feature.Title) return `(${$feature.Title})`

 

The pop's title would look like this: {name} {expression/expr0}.

I'm not clear on how the 'Alternative Title' fits into this, though

 

 

StephenKing3
New Contributor III

Thank you @BernSzukalski and @KenBuja for the pointers. I have managed to get something working based on your pointers.

0 Kudos