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)
RobElliott
Aug 23, 2022Silver Contributor
Stanislawo "visibility": "=if([$Approvers] == '' ,'hidden','visible')" where the =='' uses single quotes.
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
- StanislawoAug 23, 2022Copper ContributorThank you so much!! I'm a bit gutted that I didn't try that, do you know how I could incoroporate an and statement into the if statement? Exact same thing but for another column called senders.
- RobElliottAug 23, 2022Silver Contributor
Stanislawo just add && [$Senders]=='' for and or use pipes || for or
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)- StanislawoAug 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!!