Forum Discussion
Sharepoint List Column Formatting
- Jun 28, 2021
DevHuws Not sure if I understood it correctly. But, either of below JSON codes should work for you:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json", "additionalRowClass": "=if(([$DueDate] && [$DueDate] <= @now) || ([$EndDate] && [$EndDate] <= @now) || ([$AnyOtherDateColumn] && [$AnyOtherDateColumn] <= @now), 'sp-field-severity--severeWarning', '')" }OR
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json", "additionalRowClass": "=if((Number([$DueDate]) !=0 && [$DueDate] <= @now) || (Number([$EndDate]) !=0 && [$EndDate] <= @now) || (Number([$AnyOtherDateColumn]) !=0 && [$AnyOtherDateColumn] <= @now), 'sp-field-severity--severeWarning', '')" }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.
DevHuws Not sure if I understood it correctly. But, either of below JSON codes should work for you:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if(([$DueDate] && [$DueDate] <= @now) || ([$EndDate] && [$EndDate] <= @now) || ([$AnyOtherDateColumn] && [$AnyOtherDateColumn] <= @now), 'sp-field-severity--severeWarning', '')"
}
OR
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if((Number([$DueDate]) !=0 && [$DueDate] <= @now) || (Number([$EndDate]) !=0 && [$EndDate] <= @now) || (Number([$AnyOtherDateColumn]) !=0 && [$AnyOtherDateColumn] <= @now), 'sp-field-severity--severeWarning', '')"
}
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.
- J27Sep 03, 2021Copper Contributorganeshsanap,
Hi Ganesh,
I have a same scenario in Sharepoint where if column value is >0, then it need to be in red color. It's a calculated column like below
if([DueDate]-[ActivationDate]>28, "[Other column] * 1000", 0$). I don't want to do anything with this formula. Only color formatting need to be applied if column value >0, then red color.
Do you have any suggestions, please.
Regards
Janaa- RobElliottSep 03, 2021Silver Contributor
J27 you just need to format the column as below, it doesn't matter that it's a calculated column.
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "=[$Percent]*100 + '%'", "style": { "color": "=if([$Percent] > 0 , '#80000d', '#3b3b3b'" } }Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)- J27Sep 03, 2021Copper ContributorRobElliott
Could you please let me know, do I need to change the $Percent to my column. Above code doesn't works for me when I pasted this in JSON Column Formatting area.
Thanks for your time.
Regards
Janaa