In my pop-ups, I have 3 Arcade expressions similar to the one below. Prior to yesterday's AGOL update, this expression was returning a bulleted list (one value per bullet). Since the update, it's now returning a long string of values separated by commas. How can I fix the code so that it again returns a bulleted list? I can't find anything in Esri's list of updates that would cause this?
var ballfieldyn = iif($feature.ballfield=="Yes", 'Ballfield', '')
var basketballyn = iif($feature.basketball=="Yes", 'Basketball', '')
var cricketyn = iif($feature.cricket=="Yes", 'Cricket', '')
var discgolfyn = iif($feature.discgolf=="Yes", 'Disc Golf', '')
var footballyn = iif($feature.football=="Yes", 'Football', '')
var golfyn = iif($feature.golf=="Yes", 'Golf', '')
var pickleballyn = iif($feature.pickleball=="Yes", 'Pickleball', '')
var racquetballyn = iif($feature.raquetball=="Yes", 'Racquetball', '')
var sandvolleyballyn = iif($feature.sandvolleyball=="Yes", 'Sand Volleyball', '')
var socceryn = iif($feature.soccer=="Yes", 'Soccer', '')
var swimmingyn = iif($feature.swimming=="Yes", 'Swimming', '')
var tennisyn = iif($feature.tennis=="Yes", 'Tennis', '')
var sportslist = [ballfieldyn, basketballyn, cricketyn, discgolfyn, footballyn, golfyn, pickleballyn, racquetballyn, sandvolleyballyn, socceryn, swimmingyn, tennisyn]
// Initialize an empty array for non-empty values
var filteredList = []
// Loop through the 'sportsList' and add non-empty values
for (var i = 0; i < Count(sportsList); i++) {
if (sportsList[i] != '') {
// Append to the filtered list
Push(filteredList, sportsList[i])
}
}
// Return the filtered list
return filteredList
What it used to return:
What it's returning now:
Solved! Go to Solution.
Hi @MelissaSullivan,
Try this.
var sportslist = Dictionary(
'ballfield', 'Ballfield',
'basketball', 'Basketball',
'cricket', 'Cricket',
'discgolf', 'Disc Golf',
'football', 'Football',
'golf', 'Golf',
'pickleball', 'Pickleball',
'raquetball', 'Ballfield',
'pickleball', 'Racquetball',
'sandvolleyball', 'Sand Volleyball',
'soccer', 'Soccer',
'swimming', 'Swimming',
'tennis', 'Tennis'
)
Expects($feature,'*')
var String = []
for( var f in $feature){ if( HasKey(sportslist),f) && $feature[f] == 'YES' ){ Push(String,'• '+sportslist[f]) } }
iif( Count( String ) > 0 , Concatenate(String,'\n'), 'No Activities' )
Hi @MelissaSullivan,
Try this.
var sportslist = Dictionary(
'ballfield', 'Ballfield',
'basketball', 'Basketball',
'cricket', 'Cricket',
'discgolf', 'Disc Golf',
'football', 'Football',
'golf', 'Golf',
'pickleball', 'Pickleball',
'raquetball', 'Ballfield',
'pickleball', 'Racquetball',
'sandvolleyball', 'Sand Volleyball',
'soccer', 'Soccer',
'swimming', 'Swimming',
'tennis', 'Tennis'
)
Expects($feature,'*')
var String = []
for( var f in $feature){ if( HasKey(sportslist),f) && $feature[f] == 'YES' ){ Push(String,'• '+sportslist[f]) } }
iif( Count( String ) > 0 , Concatenate(String,'\n'), 'No Activities' )
Hi @MelissaSullivan - the behavior you are referring to was undocumented and not part of the WebMap spec. To create a bulleted list of items from an Arcade expression, I would recommend using the Arcade content type in your popup and returning the "Text" content type. This will allow you to return HTML content, like an unordered list (<ul>, <li>). You can see a similar example in this blog post: https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/summarize-and-explore-point-clusters...