Nov 22 2023 02:24 AM
Hi,
I have 3 columns of data : Status, Owner, Date.
I'd like to have the sharepoint view (not column formatting) to show the lines in my list in :
- RED if none of the fields has info in it
- Orange if Status and Owner has info in it and Date is empty
- Gray if all of them contain info (not empty)
I have tried going through the sharepoint list condtitionnal formating view but the only rules we can set up in place is based on the "equal"/"not equal" to a specific value in the field. Given that my status field has more than 10 different statuses, it's quite complicated to work this way (same for owner field that might have more than 1000 different values).
I was wondering if the format view can be done based on empty/not empty rather than based on specific values?
Thanks
Nov 22 2023 04:57 AM
What is the column type for each of these fields?
I am assuming:
I am asking this because JSON formatting will be based on column types in SharePoint.
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.
Nov 22 2023 05:15 AM
If Status is single selection choice column, Owner is single selection person or group column and "Date is a Date & Time column, you can use JSON view formatting like below in "Advanced mode":
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if([$Status]=='' && Number([$DueDate])==0 && [$Owner.title]=='', 'ms-bgColor-red', if([$Status]!='' && Number([$DueDate])==0 && [$Owner.title]!='','ms-bgColor-orangeLighter',if([$Status]!='' && Number([$DueDate])!=0 && [$Owner.title]!='','ms-bgColor-gray100','')))"
}
Output:
Where Status, Owner and DueDate are internal names of your SharePoint list columns. You can get the internal name of your SharePoint list columns by following this article: How to find the Internal name of columns in SharePoint Online?
Here, I have used Number([$DueDate]) == 0 to check if Date & Time column in SharePoint list is empty or not. You can find other ways to check if date & time column is empty or not using SharePoint JSON formatting 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.
Nov 23 2023 01:38 PM
Thanks for the help.
Nov 23 2023 09:13 PM
You are welcome. Can you please confirm if the provided solution worked for you?
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.
Nov 27 2023 02:56 AM
@ganeshsanap In all honesty, I didn't want to bother any longer with questions since the solution provided i'm unable to work with, too technical for a beginner like me. That's why I added a new column, give a manual status to it, and the colouring will be done based on the status.