Question

I am trying to make the text say Expired or Current compared to a date column OR stay blank if the date column is blank. So far, I have:

"txtContent": "=if([$ExpiryDate]) == '',  '' , if([$ExpiryDate] <= @now, 'Expired', if([$ExpiryDate] > @now, 'Current', '')))"

But for whatever reason, the column then shows the ENTIRE formula in the column instead. I have tried several different permutations of the above, including isblank, but I just can't seem to get the syntax exactly how SharePoint likes it.

Was it helpful?

Solution

You can use Number(DateTimeColumn) == 0 to check if the date column is blank or not. This is the major hint, rest you can build the JSON code around it according to your other conditions.

So, try something like this:

=if(Number([$ExpiryDate]) == 0, '' , if([$ExpiryDate] <= @now, 'Expired', 'Current'))

Reference:

Make a column no background colour if no value

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top