Select to view content in your preferred language

New Map Viewer: Differences between popup Arcade content and Arcade attribute expression

369
0
08-09-2023 10:20 AM
Labels (2)
ZachBodenner
MVP Regular Contributor

Hello,

Is there any resource that details the different capabilities provided by the Arcade popup content item and just regular old building an arcade expression? As an example, I used this snipped of code in the Arcade popup content as part of an Arcade Field Template:

 

if ( IsEmpty($feature.Species) ) {
  species = "<font color='#aa0000'><b>NO DATA</b></font>";
} else {
  species = "<font color='#1f968b'>" + $feature.Species + "</font>";
}

  and get this result:

 

ZachBodenner_0-1691601478303.png

 

 

But when I go into the popup menu and use the expression builder to build a new expression and try to do some similar text formatting I get a different result:

 

for (var f in relatedDataSorted){
    
    popupString += Text(f.Date, 'MMMM Y') + TextFormatting.NewLine +
    
        "<font color= '#aa0000'<b>Maintenance Performed: </b></font>" +
        DefaultValue(f.Maintenance_Performed, 'No maintenance performed') + TextFormatting.NewLine +

 

ZachBodenner_1-1691601573724.png

 

The formatting is just returned as text. Am I missing something obvious? It appears to me that these two different ways to use Arcade have different capabilities. Is that not true? If it is true, are there resources that explain how to use these two things differently?

0 Kudos
0 Replies