Forum Discussion
288088
Nov 05, 2019Brass Contributor
Need help with formating colors based on time in columns
Hello!
Need some help with formating columns based on what time they got, if its more or less, then I want it to change color. See pictures.
Sorry for my bad english, hope you guys can help me anyway 🙂
I managed with another code to get the result that I wanted, but thanks for the effort!
{ "$schema": "<a href="https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json" target="_blank">https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json</a>", "elmType": "div", "attributes": { "class": "=if(@currentField <= '02:00:00', 'sp-field-severity--good', if(@currentField >= '02:00:00', 'sp-field-severity--blocked', '" }, "children": [ { "elmType": "span", "style": { "display": "inline-block", "padding": "0 4px" }, "attributes": { "iconName": "=if(@currentField <= '02:00:00', 'CheckMark', if(@currentField >= '02:00:00', 'Warning', '" } }, { "elmType": "span", "txtContent": "@currentField" } ] }
- Matti PaukkonenIron Contributor
- 288088Brass Contributor
Matti Paukkonen Hello! Those columns are "Calculated" Values
15min has formula:
=TEXT([Assigned technicians]-[case received];"h:mm:ss")
Response time has formula:
=TEXT(Started-[case received];"h:mm:ss")
- Matti PaukkonenIron Contributor
Here is an example for 15min column, just replace the field references with your fields and add $schema reference in the beginning (editor messes up the links 😞 )
{ "elmType": "div", "attributes": { "class": {"operator":"?", "operands":[ {"operator":"<","operands":[ "[$assigned]", { "operator": "+", "operands": [ "[$case]", 900000 ] }]},"sp-field-severity--good","" ]} }, "children": [ { "elmType": "span", "style": { "display": "inline-block", "padding": "0 4px" }, "attributes": { "iconName": {"operator":"?", "operands":[ {"operator":"<","operands":[ "[$assigned]", { "operator": "+", "operands": [ "[$case]", 900000 ] }]},"CheckMark","" ]} } }, { "elmType": "span", "txtContent": "@currentField" } ] }