Forum Discussion
444456464
Feb 22, 2022Copper Contributor
Display a value in a column with colors based on another column
Hello, I have a list that looks like this: I would like to use JSON code so that when the value indicated in the "Lundi" column is greater than that indicated in the "Taux occupation ma...
- Feb 22, 2022
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField", "style": { "color": "=if(@currentField >[$Tauxoccupationmaximal] , 'red', if(@currentField <[$Tauxoccupationmaximal], 'green' , 'orange')" } }
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
444456464
Feb 22, 2022Copper Contributor
No, I have to do something like in the formatting of the Lundi column:
(But this code does not work)
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"color": "=if(@currentField >[$Tauxoccupationmaximal], '#f00020',''), if(@currentField <[$Tauxoccupationmaximal], '#f008000',''), if(@currentField =[$Tauxoccupationmaximal], '#ff8000','')"
}
}
RobElliott
Feb 22, 2022Silver Contributor
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"color": "=if(@currentField >[$Tauxoccupationmaximal] , 'red', if(@currentField <[$Tauxoccupationmaximal], 'green' , 'orange')"
}
}
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
- 444456464Feb 22, 2022Copper ContributorThank you so much ! 😄