Arcade Text Formatting - Bold Text

5249
14
Jump to solution
01-30-2020 11:07 AM
ChantellKrider1
New Contributor

I'm having difficulty formatting the following expression such that result will BOLD words indicated below. 

I understand that the labeling expression should be "<BOL>" + $feature.LABELFIELD + "</BOL>

 

/*Eligibility*/
if($feature["Comm_Eligi"]=="Eligible") {
if($feature["UP_Eligibl"]=="Eligible") {
return("Your jurisdiction is eligible under the Communities in Need criteria and the required minimum match is " + $feature["Comm_Match"] + " percent." + Textformatting.NewLine + "Your jurisdiction also is eligible under the Underserved Populations criteria: map your project to determine the required minimum match." )
} else {
return("Your jurisdiction is eligible under the Communities in Need criteria and the required minimum match is " + $feature["Comm_Match"] + " percent.")
}
} else if($feature["Comm_Eligi"]=="Not Eligible") {
if($feature["UP_Eligibl"]=="Not Eligible") {
return("Your jurisdiction is not eligible for a match reduction.")
} else {
return("Your jurisdiction is eligible under the Underserved Populations criteria: map your project to determine the required minimum match.")
}
}

Tags (1)
0 Kudos
14 Replies
ShawnLanning
New Contributor II

Xander (or anyone with an idea) any thoughts on how I could bold portions of an Arcade Expression that are being by a for loop? Example:

Species: American Kestrel

Taxa: Bird

Occurrence Potential: Year Round

Species: Chestnut-collard Longspur

Taxa: Bird

Occurrence Potential: Winter Resident

I have the loop working but would like to Bold the Labels so it looks like: 

Species: American Kestrel

Taxa: Bird

Occurrence Potential: Year Round

Since it is all being built by via a string variable inside the loop I don't believe the example above will work, and so far I haven't had any brilliant ideas for a solution.  Thoughts?

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Shawn Lanning ,

In ArcGIS Pro you can do this using HTML. 

Let's have a look what happens under the hood. In the  configuration of the pop-up you will need to use the Text option:

When you configure the text options, you can switch on the HTML mode and you can see that the last line refers to the Arcade expression:

In the Arcade expression you loop through your species and add html tags around the field name to make them bold and use line breaks to create new lines. Something like this:

0 Kudos
AllisonMuise2
New Contributor III

@XanderBakker Are there plans to add this functionality to ArcGIS Online? 

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi @AllisonMuise2 ,

Sorry for the delay. I am sure we will have this functionality in the future, but unfortunately, I don't have an ETA. 

0 Kudos
AllisonMuise2
New Contributor III

If you need a use case: I'm building a popup for a tax parcels layer that contains geometry but relatively few attributes. Information on single family residences and land characteristics of that parcel are stored in stand-alone tables that each have dozens of attributes. I'd like to be able to include a table of SFR chars and a table of land chars in the tax parcel popup (or even control bolding and whitespace between label and value).

Currently, to build this structure, I need to query each table for each attribute individually which is prohibitively slow for this number of attributes. If I could return the formatting with the arcade expression, this could be done with a single query to each table.