Arcade Text Formatting - Bold Text

17949
17
Jump to solution
01-30-2020 11:07 AM
ChantellKrider1
New Contributor II

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
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Hi chantell.krider_wa_rco 

As I mentioned in my previous post, this does not work (yet) in ArcGIS Online. To create the bold text in the pop-up in ArcGIS Online will require custom HTML configuration and multiple Arcade expressions.

View solution in original post

0 Kudos
17 Replies
XanderBakker
Esri Esteemed Contributor

Hi chantell.krider_wa_rco ,

I assume this would be like this:

/*Eligibility*/
if ($feature["Comm_Eligi"]=="Eligible") {
    if ($feature["UP_Eligibl"]=="Eligible") {
        return("Your jurisdiction is eligible under the <BOL>Communities in Need</BOL> criteria and the required minimum match is " + $feature["Comm_Match"] + " percent." + Textformatting.NewLine + "Your jurisdiction also is eligible under the <BOL>Underserved Populations</BOL> criteria: map your project to determine the required minimum match." )
    } else {
        return("Your jurisdiction is eligible under the <BOL>Communities in Need</BOL> 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 <BOL>Underserved Populations</BOL> criteria: map your project to determine the required minimum match.")
    }
}

Note that this might work in ArcGIS Pro, but not (yet) in ArcGIS Online.

0 Kudos
ChantellKrider1
New Contributor II

Nope. The results are below. 

 

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi chantell.krider_wa_rco 

As I mentioned in my previous post, this does not work (yet) in ArcGIS Online. To create the bold text in the pop-up in ArcGIS Online will require custom HTML configuration and multiple Arcade expressions.

0 Kudos
ChantellKrider1
New Contributor II

Okay. Thank you for the help. 

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Chantell Krider ,

I can show you how to do this with the custom HTML configuration in combination with 4 Arcade expressions, if that's an option for you...

0 Kudos
ChantellKrider1
New Contributor II

Yes. That would be awesome! 

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Chantell Krider ,

Let me first explain the sample dataset I created. I have 4 points and added the Com_Eligi and UP_Eligibl values:

The attribute table looks like this:

You can see that I have 4 "Eligibility" fields added, containing "block" or "none". Those are the results of the Arcade expressions listed below:

// Eligibility1:
if (($feature["Comm_Eligi"]=="Eligible") && ($feature["UP_Eligibl"]=="Eligible")) {
        return "block";
} else {
        return "none";
}

 

// Eligibility2:
if (($feature["Comm_Eligi"]=="Eligible") && ($feature["UP_Eligibl"]=="Not Eligible")) {
        return "block";
} else {
        return "none";
}‍‍‍‍‍‍‍‍‍‍‍‍

// Eligibility3:
if (($feature["Comm_Eligi"]=="Not Eligible") && ($feature["UP_Eligibl"]=="Not Eligible")) {
        return "block";
} else {
        return "none";
}‍‍‍‍‍‍‍‍‍‍‍‍

// Eligibility4:
if (($feature["Comm_Eligi"]=="Not Eligible") && ($feature["UP_Eligibl"]=="Eligible")) {
        return "block";
} else {
        return "none";
}‍‍‍‍‍‍‍‍‍‍‍‍

Those will appear numbered as 0 to 3 in the list of Arcade expressions in the pop-up configuration:

The next part is the configuration of the custom HTML pop-up:

Next hit the green "CONFIGURE" button and activate the "View HTML Source" in the Custom Attribute Display:

 

As HTML source you should copy and paste the following:

<span style="display:{expression/expr0}">Your jurisdiction is eligible under the <b>Communities in Need</b> criteria and the required minimum match is {Comm_Match} percent. <br />Your jurisdiction also is eligible under the <b>Underserved Populations</b> criteria: map your project to determine the required minimum match.</span>
<span style="display:{expression/expr1}">Your jurisdiction is eligible under the <b>Communities in Need</b> criteria and the required minimum match is {Comm_Match} percent.</span>
<span style="display:{expression/expr2}">Your jurisdiction is not eligible for a match reduction.</span>
<span style="display:{expression/expr3}">Your jurisdiction is eligible under the <b>Underserved Populations</b> criteria: map your project to determine the required minimum match.</span>

The result should be like this:

ChantellKrider1
New Contributor II

Impressive! I'm guessing I'll need to pre-populate the attribute table according to the "blocks" vs. "none". Is that correct? Thank you! I'll give it a try. 

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi chantell.krider_wa_rco ,

You do not have to change your data and add fields. The ones you are seeing are "virtual" fields created by the Arcade expressions.

0 Kudos