Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sharepoint Column Formatting Assistance

Status
Not open for further replies.

Erichss

Technical User
Jun 6, 2023
1
0
0
US
I need a bit assistance with the JSON coding for what I need/want to do.
I have a document library, I have a column named Exp Date. What I would like to have happen is the text for the date turns orange if the current date is within 6 months of the Exp Date and red if the current date is within 30 days of the Exp Date and green if it's not within the two conditions.

Below is the code I am using, what little I know of JSON, I thought this was correct, but it's not working. It will do the fist condition and set it to orange, but it's not setting the condition for red, but at the end it does set all others to green.

I am sure it's a simple syntax error, but I am just not seeing it at the moment.



{

"$schema": " ;,

"elmType": "div",

"txtContent": "@currentField",

"style": {

"color": "=if(@currentField <= @now + 15552000000, 'orange',if(@currentField <= @now + 2592000000, 'red','green'))"

}

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top