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.")
}
}
Solved! Go to Solution.
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?
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:
@XanderBakker Are there plans to add this functionality to ArcGIS Online?
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.
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.
Any update on html formatting within an arcade expression in AGOL?
With the expression below, I'd like to make the fields "TIME:", "HR:", etc... be in bold.
// Access table as a FeatureSet
var portal = Portal("https://www.arcgis.com")
var vitals = FeatureSetByPortalItem(portal,
"4bdfd61b80b44a1ea57a299f4f09b176", 1, ['vital_time','vital_pulse','vital_rr','vital_bp','vital_sp','vital_pupil','vital_csm','vital_cardiac','vital_eyes','vital_verbal','vital_motor','vital_gcs'])
// Filter related features by using a common attribute
var globalid = $feature.globalid
var filterStatement = 'parentglobalid = @globalid'
// Related features as a variable
var relatedData = Filter(vitals, filterStatement)
// Sort related features by oldest to newest
var relatedDataSorted = OrderBy(relatedData, 'CreationDate')
// Build the pop-up string by iterating through all related features
var popupString = ''
for (var f in relatedDataSorted)
{
popupString += "TIME: " + DefaultValue(f.vital_time,'_')
+ " HR: " + DefaultValue(f.vital_pulse,'_')
+ " BP: " + DefaultValue(f.vital_bp,'_')
+ " RR: " + DefaultValue(f.vital_rr,'_')
+ " SPO2: " + DefaultValue(f.vital_sp,'_')
+ " PUPILS: " + DefaultValue(f.vital_pupil,'_')
+ " CSM: " + DefaultValue(f.vital_csm,'_')
+ TextFormatting.NewLine + "CARDIAC MONITOR: " + DefaultValue(f.vital_cardiac,'_')
+ TextFormatting.NewLine + "EYES: " + DefaultValue(f.vital_eyes,'_')
+ " VERBAL: " + DefaultValue(f.vital_verbal,'_')
+ " MOTOR: " + DefaultValue(f.vital_motor,'_')
+ " GCS SCORE: " + DefaultValue(f.vital_gcs,'_')
}
DefaultValue(popupString, 'No Vitals Taken')
This is great for popups, but any way to do this in labels? Here is what I have in Pro, which works fine:
"<BOL>" + $feature.FAC_TYPE + "</BOL>" + ' – ' + $feature.FAC_NAME
In ArcGIS Online, that shows up like this:
If I change it to the HTML standard of <B> and </B>, I just get those literal strings, just like above, but missing the "OL".
I thought Arcade was supposed to work across all platforms.
I would like to see this functionality extended to ArcGIS Pro tables. My use case:
-I have a road map with index grid and would like to bold attributes that only contain 1 character (A, B, C etc.) to make my 'legend' a little easier to navigate