Morning Community, I have a calculated field in my list which will show either a score (number) or FAIL when Compliance column = No. I'm trying to get the column to display as red when it is a FAIL (with a warning icon), else show a tick and the score.
My code below has the scores showing correctly, though the FAIL ended up with a tick and the word became invisible.
Help ... TIA
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"class": "=if(@currentField == 'FAIL', 'sp-field-total--severeWarning', 'sp-field-total--good') + ' ms-fontColor-neutralSecondary'"
},
"children": [
{
"elmType": "span",
"style": {
"display": "inline-block",
"padding": "0 4px"
},
"attributes": {
"iconName": "=if(@currentField == 'FAIL', ' ErrorBadge', 'CheckMark')"
}
},
{
"elmType": "span",
"txtContent": "@currentField"
}
]
}