Forum Discussion
288088
Nov 10, 2019Brass Contributor
If calculated value column exceeds 24 hours
Hi!
I got this calculated column that shows values of "hh:mm:ss". But i've noticed that if its exceeds 24:00:00 it will restarts to ex. 01:00:00..
Is there anywat to make a validation or format the column so when it exceeds ex. 23:59:59 it will show the text "Over 24> hours" or something? Or is there any way to make it exceed 24:00:00?
This is my code in the calculated column:
{
"$schema": "<a href="<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>" target="_blank"><a href="https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json</a" target="_blank">https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json</a</a>>",
"elmType": "div",
"attributes": {
"class": "=if(@currentField <= '02:00:00', 'sp-css-backgroundColor-successBackground50', if(@currentField >= '02:00:00', 'sp-css-backgroundColor-errorBackground50', '"
},
"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"
}
]
}
7 Replies
- O365DeveloperBrass Contributor
- 288088Brass Contributor
I'm kinda new to this, where in my code should I input this code?
Did like example below, doesnt work. Guess its all wrong
{ "$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-css-backgroundColor-successBackground50', if(@currentField >= '02:00:00', 'sp-css-backgroundColor-errorBackground50', '" }, "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 > 24 ? 'Over 24 hours' : @currentField } ] }- O365DeveloperBrass Contributor
Can you please try enclosing them in double quotes?