I'm beginner/intermediate when it comes to SharePoint JSON, and I've been trying all sorts of conditional logic to make an empty column txtContent show 'Yes' or 'No'.
There are 7 columns (all date columns) that need to be validated in one sharepoint list - if ANY of them are overdue (equal to or less than @now), then new column should say 'No'. If all of them are greater than @now (or null) then 'Yes'.
I got this far (but of course it doesn't work). JSONLint says it's ok, but there's obviously something weird I'm doing that is keeping this column blank.
Can you see what I've missed or done incorrectly??? (probably loads)
{
"$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
"elmType": "div",
"txtContent": "='(' + if([$datecolumn1] <= @now, 'No', if([$datecolumn2] <= @now, 'No', if([$datecolumn3] <= @now, 'No', if([datecolumn4] <= @now, 'No',if([$datecolumn5] <= @now, 'No', if([$datecolumn6] <= @now, 'No', if([$datecolumn7] <= @now, 'No', 'Yes'))))))) + ')'",
"style": {
"background-color": "=if(txtContent == 'Yes', '#107c10', if(txtContent == 'No', '#e81123', ''))"
}
}
=IF([$DateColumn1] > @now && [$DateColumn2] > @now && [$DateColumn3] > @now && [$DateColumn4] > @now && [$DateColumn5] > @now && [$DateColumn6] > @now && [$DateColumn7] > @now, "Yes", "No")
. It should work for you. Let me know if it works or if you found any issue in this.&&
for ANDing the two conditions and||
for ORing two conditions. Check Operators supported in JSON formatting.