Forum Discussion
BrandThe
Dec 12, 2024Copper Contributor
JSON Conditioning with multiple IF statements
Hello I am trying to format a date column. The date in the column is a date that someone completed a certification and that certification expires after one year. I am trying to using conditional form...
Dec 25, 2024
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"class": "=if([$CertificationDate] >= @now - 31536000000, 'sp-field-severity--good', if([$CertificationDate] >= @now - 5184000000, 'sp-field-severity--warning', 'sp-field-severity--severeWarning'))"
},
"children": [
{
"elmType": "span",
"style": {
"display": "inline-block",
"padding": "0 4px"
},
"attributes": {
"iconName": "=if([$CertificationDate] >= @now - 31536000000, 'CheckMark', if([$CertificationDate] >= @now - 5184000000, 'Warning', 'ErrorBadge'))"
}
},
{
"elmType": "span",
"txtContent": "=[$CertificationDate]"
}
]
}
Fixed it for you ! :)