Forum Discussion
Conditional Formatting based on empty Date column
Amapola67 If you want to format entire row based on empty date column, you have to use view formatting.
Example:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if([$StartDate], '', 'sp-field-severity--severeWarning')"
}
Similarly, you can apply any of the predefined classes instead of 'sp-field-severity--severeWarning' as given in below links as per your requirements:
See other ways to check if date column is empty at: SharePoint JSON formatting: Check if date & time column is blank/empty
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
As I have multiple conditional formats, I need to put your code into what was generated. I made the read bit Date is not some date but it generates an awful lot of code compared to your string. (I know from VBA that a well-structured code is easier to read but JSON seems to go a bit over the top! It's no longer well structured, it's blown up.)
And quite frankly, I can't make head or tail of the code. There's no if that I can see.
Can I incorporate your code string in this?
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "Date()",
"operands": [
{
"operator": "toDateString()",
"operands": [
{
"operator": "Date()",
"operands": [
"[$EnteredPhoenix]"
]
}
]
}
]
},
{
"operator": "Date()",
"operands": [
{
"operator": "toDateString()",
"operands": [
{
"operator": "Date()",
"operands": [
"Sun Jan 01 2012"
]
}
]
}
]
}
]
},
"sp-css-backgroundColor-BgPeach sp-css-color-PeachFont",