User Profile
LearningSharepoint
Copper Contributor
Joined 3 months ago
User Widgets
Recent Discussions
Conditional Formatting for Dates using JSON
Hello, I am trying to use conditional formatting for MS List. I specifically want the background colour of the date to change based upon the number of days over since the file was received. Something along the lines of 30 days = yellow, 60 days = orange, and 90 days = red. After searching here and elsewhere I've managed to put together some JSON that I believe should work, but alas it does not. There is no error shown, but the table appears untouched. Any help is appreciated. This is what I have so far: { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField", "style": { "background-color": "=""=if([$DateReceived] <= @now + 7776000000, if([$DateReceived] <= @now + 5184000000, if([$DateReceived] <= @now + 2592000000 'sp-css-backgroundColor-red', 'sp-css-backgroundColor-BgOrange', 'sp-css-backgroundColor-warningBackground40'), '')")))", "padding-left": "10px" } }Solved337Views1like7CommentsJSON Code not working when calculating Days Since Received
I am hoping to use a Microsoft List to manage a team's files. I originally used the following code in my "Days Since Received" column, however, I later learned that this formula would not automatically (dynamically?) update after noticing that the days within the column never changed after being entered: =TODAY()-[Received (date)] To rectify this, I found a suggestion on the internet to use a JSON code to try and make it so the MS List automatically updates each day on its own. Unfortunately I am receiving the following error in the Days Since Received column: =floor((Number(@now)-Number([$Received_x0020_(date)]))/(1000*60*60*24*12)/365*12) The JSON I am using is as follows: { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "=floor((Number(@now)-Number([$Received_x0020_(date)]))/(1000*60*60*24*12)/365*12)" } I am unsure what's going wrong. This is how I've set it up:Solved309Views0likes7Comments
Groups
Recent Blog Articles
No content to show