Forum Discussion
SharePoint Json If statement for visibility based on Other Colums being empty/ filled
- 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 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:
{"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!!- RobElliottAug 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)- StanislawoAug 24, 2022Copper ContributorFantastic! That's sorted it, thank you so much for the help!
- ganeshsanapAug 24, 2022MVP
Stanislawo There are couple of ways to check if date column is empty or not.
One way suggested by RobElliott using Number() function works well (+1).
Other ways are to use the toString() function OR directly refer to column name like ![$Deadline].
Check: SharePoint JSON formatting: Check if date & time column is blank/empty
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.