So i have three attributes in the list, "severity", "probability" and date. I would like to show severity in red when its value is "Severe" and probability red as well when its value is "Likely". Second, i wouldn't like the date to have any color change.
I know i have to use HTML source formatting in conjunction with Arcade for this purpose. How can I do this?
Bonus question: How can i please add a calendar icon next to the date? Please note that the date is in the second line
Current output:
Thank you 🙂
Current Arcade:
/ Condition Color the Attributes
var colorS = IIF($datapoint.severity == "Severe", "#ff0000", '')
var colorP = IIF($datapoint.probability == "Likely", "#ff0000", '')
return {
textColor: colorS,
backgroundColor: '',
separatorColor:'',
selectionColor: '',
selectionTextColor: '',
// attributes: {
// attribute1: '',
// attribute2: ''
// }
}
Current HTML source:
<p>
<strong>{field/severity}, {field/probability}</strong><br>
{field/date_and_time}
</p>
Solved! Go to Solution.
Hi Jen, that worked cheers 🙂 🎉
now how can i please add a clock or calendar icon/emoji next to the date and time field value?
// Condition Color the Attributes
var colorS = IIF($datapoint.how_severe_could_the_injury_to == "Severe", "#ff0000", '')
var colorP = IIF($datapoint.what_is_the_probability_that_in == "Likely", "#ff0000", '')
return {
textColor: '',
backgroundColor: '',
separatorColor:'',
selectionColor: '',
selectionTextColor: '',
attributes: {
attribute1: colorS,
attribute2: colorP
// }
}
}
<p>
<span style="color:{expression/attribute1};"><strong>{field/how_severe_could_the_injury_to}</strong></span>, <span style="color:{expression/attribute2};"><strong>{field/what_is_the_probability_that_in}</strong></span>
</p>
<p>
{field/date_and_time}
</p>
so far i came up with the following in the Arcade expression
Just add the emoji in the line item template next to your field: {field/date_and_time} :alarm_clock:
yup that worked like a charm thank you so much for your time and help @JenniferAcunto 🙂