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 form...
O365Developer
Nov 10, 2019Brass Contributor
288088
Nov 11, 2019Brass 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
}
]
}
- O365DeveloperNov 11, 2019Brass Contributor
Can you please try enclosing them in double quotes?
- O365DeveloperNov 12, 2019Brass Contributor
can you pls try below and post me the error message if you get any
"txtContent": ="@currentField > 24 ? 'Over 24 hours' : @currentField"- 288088Nov 13, 2019Brass Contributor
It doesnt work...
Only shows like this:
I'm getting "Enter a valid JSON column formatting code" error.
"children": [ { "elmType": "span", "txtContent": ="@currentField > 24 ? 'Over 24 hours' : @currentField", "attributes": {}, "style": { "color": { "operator": "?", "operands": [ { "operator": "==", "operands": [ "@currentField", "00:00:00"
- 288088Nov 11, 2019Brass Contributor
If I type like this I get error:
{ "elmType": "span", "txtContent": =@currentField > 24 ? "Over 24 hours" : @currentField }