Forum Discussion
List format question, with an either/or scenario
- Aug 05, 2020
alandarr just looking at your question 1 for the moment you can do this with the following JSON column formatting. In this example if the value you enter is less than or equal to 10% then it puts the background green, if it's between 11 and 50% then it's orange, otherwise it's dark red:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "=toString(@currentField * 100) + '%'", "style": { "border": "none", "padding-left": "14px", "background-color": "=if(@currentField <= 0.1,'#468259', if(@currentField > 0.1 && @currentField <= 0.5,'#d8a810', '#c00000'))", "color": "white" } }Which gives the following result:
I hope that gives you what you need.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.
alandarr just looking at your question 1 for the moment you can do this with the following JSON column formatting. In this example if the value you enter is less than or equal to 10% then it puts the background green, if it's between 11 and 50% then it's orange, otherwise it's dark red:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=toString(@currentField * 100) + '%'",
"style": {
"border": "none",
"padding-left": "14px",
"background-color": "=if(@currentField <= 0.1,'#468259', if(@currentField > 0.1 && @currentField <= 0.5,'#d8a810', '#c00000'))",
"color": "white"
}
}
Which gives the following result:
I hope that gives you what you need.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.
- alandarrAug 07, 2020Brass Contributor
I tried the solution to my first question and it worked perfectly!
I have so much to learn with these lists.
Thank you so for taking the time to help.