Bolded strings within Arcade if – then--else expression

549
3
03-30-2023 09:25 AM
TychoGranville
Occasional Contributor II

This was sort of answered in a different post (Bold Text within Arcade Expression) but I need the argument to be within the expression.
I have a giant if-then-else statement and I only want certain strings within that expression to be bolded. So the  pop-up currently looks like (sans highlighting):  Capture.JPG

But I want (only) the strings that are highlighted in the screenshot to be bold. (There are others in the pop-up (with varying positions), this is just the top of it)

Portion of the Arcade statement here for reference:

//Precinct 01
//01-01
if($feature.PRECINCT_T =='01'&&$feature.SPLIT_TXT=='01'){
return "01 West The Dalles"+TextFormatting.NewLine+TextFormatting.NewLine+"Federal Races"+TextFormatting.NewLine+TextFormatting.NewLine+"US Representative 2nd District"+TextFormatting.NewLine+TextFormatting.NewLine+"Statewide Partisan"+TextFormatting.NewLine+TextFormatting.NewLine+"Senate District 26"+TextFormatting.NewLine+TextFormatting.NewLine+"House District 52"+TextFormatting.NewLine+TextFormatting.NewLine+"Statewide Nonpartisan"+TextFormatting.NewLine+TextFormatting.NewLine+"Circuit Court District 07"+TextFormatting.NewLine+TextFormatting.NewLine+"District Attorney"+TextFormatting.NewLine+TextFormatting.NewLine+"Wasco County Elected Positions"+TextFormatting.NewLine+TextFormatting.NewLine+"City of The Dalles"+TextFormatting.NewLine+TextFormatting.NewLine+"Soil & Water Conservation District"+TextFormatting.NewLine+TextFormatting.NewLine+"N W Co PUD Subdivision #3"+TextFormatting.NewLine+TextFormatting.NewLine+"Columbia Gorge Community College"+TextFormatting.NewLine+TextFormatting.NewLine+"Columbia Gorge ESD Zone #4 - At Large"+TextFormatting.NewLine+TextFormatting.NewLine+"Columbia Gorge Education Service District Zone 2"+TextFormatting.NewLine+TextFormatting.NewLine+"N Wasco County School District #21 Zone 4"+TextFormatting.NewLine+TextFormatting.NewLine+"Mid Columbia Fire and Rescue"+TextFormatting.NewLine+TextFormatting.NewLine+"Wasco County Library Service District"+TextFormatting.NewLine+TextFormatting.NewLine+"Northern Wasco County Parks & Recreation"+TextFormatting.NewLine+TextFormatting.NewLine+"Port of The Dalles"+TextFormatting.NewLine+TextFormatting.NewLine+"Northern Oregon Corrections"+TextFormatting.NewLine+TextFormatting.NewLine+"Wasco County 4-H and Extension Service District"
}
//01.02
else if ($feature.PRECINCT_T =='01'&&$feature.SPLIT_TXT=='02') {
return "01 West The Dalles"+TextFormatting.NewLine+TextFormatting.NewLine+ "Federal Races"+TextFormatting.NewLine+TextFormatting.NewLine+"US Representative 2nd District"+TextFormatting.NewLine+TextFormatting.NewLine+"Statewide Partisan"+TextFormatting.NewLine+TextFormatting.NewLine+"Senate District 26"+TextFormatting.NewLine+TextFormatting.NewLine+"House District 52"+TextFormatting.NewLine+TextFormatting.NewLine+"Statewide Nonpartisan"+TextFormatting.NewLine+TextFormatting.NewLine+"... etc, etc


Is this doable or did I just paint myself into a corner?

Thanks,

Tycho

(I'm doing this in the MapViewer on Arc Online, this will end up on an app on our own 10.9.1 Portal)

0 Kudos
3 Replies
jcarlson
MVP Esteemed Contributor

You can't really do this in a single expression in a text element. If 11.0 is on the horizon for you, the Arcade popup element makes this a breeze, but the text block doesn't respect HTML tags that occur within a string returned by Arcade.

Are you basically making a popup list of "attributes" based on other data in the feature?

- Josh Carlson
Kendall County GIS
0 Kudos
TychoGranville
Occasional Contributor II

We upgraded to 10.9.1 about six weeks ago, so 11 is a long ways out.

And yes, the only data in the underlying FC that is used are the two fields needed for the if part of the expression.  All the other strings are from an external text file that I cleaned up and dumped into Arcade.

0 Kudos
jcarlson
MVP Esteemed Contributor

The only thing I can think of that might be helpful to you would be a Data Expression, but that would require the solution to be in a Dashboard.

- Josh Carlson
Kendall County GIS
0 Kudos