May 20 2022 03:41 PM
Trying to learn JSON so I can do some fun stuff with values coloring of lists.
I currently have a calculated column with:
=IF([Starting Date]="","",[Starting Date]+21)
and that works fine.
When I go to format the columns in Advanced mode, I'm always getting errors, sometimes without even changing anything. The error is not clear and I don't what I'm doing or not doing.
For example, leaving it like this:
May 21 2022 09:57 AM - edited May 21 2022 09:57 AM
@xoxidein "For example, leaving it like this:..." you can't do that because the JSON is not doing anything, all you've got is the schema so it will inevitably give you an error. What you need is JSON like this which is formatting the Workdays+21 column:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"padding-left": "14px",
"background-color": "=if(@currentField <= @now, '#c00000','teal')",
"color": "white"
}
}
That gives the following result:
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
May 27 2022 08:38 AM
May 29 2022 09:12 AM
Jul 08 2022 08:17 AM
@xoxidein I see the same problem with a colleague trying to save/update a piece of JSON that she's copying in that we know works - since it works if I do it. I'm guessing it has something to do with encoding (in a desktop editor I've had such problems with say Unicode) - but then I noticed that my colleague was using Edge where I always use Chrome.
She switched to Chrome and the code saved without error!