Select to view content in your preferred language

Dashboard Symbol Conditional Formatting

791
2
Jump to solution
08-23-2023 08:04 AM
awbennett
New Contributor

I'm trying to implement a basic conditional formatting script to a list in a dashboard, but my formatted symbol will not display. Here's my arcade and HTML. The variable value displays as usual for the second line, so I know the data connection is working. Changing the HTML arrows to standard characters to troubleshoot didn't work either. What am I missing?

Arcade:

var arrow = "";
var color = "";

if ($datapoint.variable > 0) {
   arrow = "⇧"; // Up arrow for positive values
   color = "green"; // Green color for positive values
} else {
   arrow = "⇩"; // Down arrow for negative values
   color = "red"; // Red color for negative values
}

return {
   arrow: arrow,
   color: color,
   };
 
HTML:

<p style="text-align:center"><span style="color:{expression/color}; font-size:18px">{expression/arrow}</span></p>

<p style="text-align:center"><span style="font-size:14px"><strong>{variable}%</strong></span></p>

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

In Advanced Formatting, expressions need to be wrapped in attributes: {...}, so try

return {
attributes: {
arrow: arrow,
color: color
}
};
- Josh Carlson
Kendall County GIS

View solution in original post

2 Replies
jcarlson
MVP Esteemed Contributor

In Advanced Formatting, expressions need to be wrapped in attributes: {...}, so try

return {
attributes: {
arrow: arrow,
color: color
}
};
- Josh Carlson
Kendall County GIS
awbennett
New Contributor

Of course it's exactly the type of simple thing I would overlook 🙃. Thanks for the quick reply!

0 Kudos