Forum Discussion
Stanislawo
Aug 23, 2022Copper Contributor
SharePoint Json If statement for visibility based on Other Colums being empty/ filled
I've been trying to create a SharePoint list in which a button is visible when two of the columns of that row have a value entered. I've tried looking for answers but can't find anything that has wor...
- Aug 24, 2022"visibility": "=if([$Approver] == '' && [$Sender]=='' && Number([$Deadline]) == 0 ,'hidden','visible')"Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
Stanislawo
Aug 23, 2022Copper Contributor
RobElliott Thanks a lot, I've this but unfortunately it looks like the date column always has a value, I tried finding what default value that may be but couldn't find anything. Here's a visual representation of the issue I've got:
Here's the code too:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "Send",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"9de29813-f1b8-4ebc-870e-fe3a7a4472af\"}"
},
"style": {
"padding": "0px 25px",
"cursor": "pointer",
"border": "none",
"color": "white",
"font-weight": "550",
"background-color": "#0078d4",
"text-decoration": "none",
"font-size": "14px",
"text-align": "center",
"width": "85px",
"visibility": "=if([$Approver] == '' || [$Sender] == '' || [$Deadline] == '','hidden','visible')"
}
}
I only want the button to show when all 3 values have been set but, SP seems to think that there's always a value under the date column. But maybe I've just coded it wrong. Any advice would be much appreciated!!
RobElliott
Aug 24, 2022Silver Contributor
"visibility": "=if([$Approver] == '' && [$Sender]=='' && Number([$Deadline]) == 0 ,'hidden','visible')"
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
- StanislawoAug 24, 2022Copper ContributorFantastic! That's sorted it, thank you so much for the help!