Nov 10 2019 02:52 PM
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"
}
]
}
Nov 10 2019 08:18 PM
Nov 11 2019 01:43 AM
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
}
]
}
Nov 11 2019 07:12 PM
Can you please try enclosing them in double quotes?
Nov 11 2019 10:13 PM
If I type like this I get error:
{
"elmType": "span",
"txtContent": =@currentField > 24 ? "Over 24 hours" : @currentField
}
Nov 12 2019 03:19 PM
can you pls try below and post me the error message if you get any
"txtContent": ="@currentField > 24 ? 'Over 24 hours' : @currentField"
Nov 13 2019 05:41 AM
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"
Nov 13 2019 06:02 PM
Hi,
Thats a mistake in typo