Can anyone explain this? I wrote this JSON back in June. It's to show birthdays for the current month. I have a simple list with a date field. To hide rows that are not in current month, I am comparing getMonth of the birth date versus @now.
Notice: my txtContent shows the result of the evaluation. When I publish the view - I'm getting no data. (Oddly - this worked in June and July.)
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"hideSelection": true,
"hideColumnHeader": true,
"rowFormatter": {
"elmType": "div",
"style": {
"display": "=if(getMonth([$DateOfBirth])==getMonth(@now)), 'block', 'none')",
"white-space": "nowrap",
"overflow": "hidden",
"margin": "1px 4px 4px 1px"
},
"attributes": {
"max-width": "150px"
},
"children": [
{
"elmType": "div",
"style": {
"text-align": "left",
"font-size": "18px",
"font-weight": 400,
"font-family": "Segoe UI, Arial, Tahoma"
},
"children": [
{
"elmType": "span",
"_comment_": "=getMonth([$DateOfBirth])+'/'+getDate([$DateOfBirth])+' - '+[$Title]+' - '+getMonth(@now)",
"txtContent": "=getMonth([$DateOfBirth])==getMonth(@now)"
}
]
}
]
}
}
When I preview - I get only TRUE entries (those with matching month values). When I save and refresh - it shows blank.
schema
? use only one which is required. What is_comment_
? check if it is supported in JSON formatting. Also, try hard refresh (ctrl + f5) & clearing browser cache after saving the JSON.