Forum Discussion
JSON Column Formatting in Sharepoint based on an address field
- Jun 24, 2020
GeoffersThere is no direct way but you can always use a workaround. Like shown below
Step 1: Create a Calculated Column And add the formula which checks the Address is empty or not. Like shown below: (I am making sure address should have a postal code)
Step2: Then use that column to check if the Address is present then show or hide the button on the basis of Calculated column.
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "span", "style": { "color": "#0078d7", "background-color": "White", "visibility": { "operator": "?", "operands": [ { "operator": "==", "operands": [ "[$CheckAddress]", "Present" ] }, "visible", "hidden" ] } }, "children": [ { "elmType": "span" }, { "elmType": "button", "txtContent": "Send Mail", "customRowAction": { "action": "executeFlow", "actionParams": "{\"id\": \"e290feff-0013-41f2-97dd-91a37fb84ea0\"}" } } ] }Vik
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
GeoffersThere is no direct way but you can always use a workaround. Like shown below
Step 1: Create a Calculated Column And add the formula which checks the Address is empty or not. Like shown below: (I am making sure address should have a postal code)
Step2: Then use that column to check if the Address is present then show or hide the button on the basis of Calculated column.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "span",
"style": {
"color": "#0078d7",
"background-color": "White",
"visibility": {
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"[$CheckAddress]",
"Present"
]
},
"visible",
"hidden"
]
}
},
"children": [
{
"elmType": "span"
},
{
"elmType": "button",
"txtContent": "Send Mail",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"e290feff-0013-41f2-97dd-91a37fb84ea0\"}"
}
}
]
}
Vik
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for this solution. It works perfectly. I have added more address fields to the formula to make for a more robust check but the principle is exactly as you have outlined. My formula is
=IF(AND(ISBLANK([Address: Postal Code]),ISBLANK([Address: Street]),ISBLANK([Address: Name])),"Empty","Present")