Sep 19 2023 01:43 PM
Sep 19 2023 01:43 PM
I have used json to format a microsoft list footer with no json errors, but the function is not working. Here is excerpt:
"display": "=if([$Column1] == 'A','display','none'),
"txtContent": "=if([$Column2] == '1' ||[$Column2] == '2', ' Dog ', 'Cat')",
The "txtContent" works fine, the "display" is showing regardless of what value is in Column 1.
I only want text to appear if column1 = A. If it is, I want the text to either be dog or cat based on the value in column2.
Sep 20 2023 02:48 AM - edited Sep 20 2023 03:00 AM
Solution@Deleted you're using the wrong style, it should be visibility, not display:
"visibility": "=if([$Column1]=='A', 'visible', 'hidden')"
For example:
{
"elmType": "div",
"style": {
"width": "100%",
"text-align": "left",
"overflow": "hidden",
"border-top-width": "1px"
},
"children": [
{
"elmType": "div",
"style": {
"height": "15px",
"width": "100%",
"color": "#fff",
"font-size": "13px",
"border-top": "5px solid #eee",
"background-color": "orange",
"padding": "10px",
"visibility": "=if([$Column1]=='A', 'visible', 'hidden')"
},
"children": [
{
"elmType": "div",
"txtContent": "=if([$Column2] == '1' ||[$Column2] == '2', ' Dog ', 'Cat')"
}
]
}
]
}
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP UK (and classic 1967 Morris Traveller driver)
Sep 20 2023 07:29 AM
Sep 20 2023 02:48 AM - edited Sep 20 2023 03:00 AM
Solution@Deleted you're using the wrong style, it should be visibility, not display:
"visibility": "=if([$Column1]=='A', 'visible', 'hidden')"
For example:
{
"elmType": "div",
"style": {
"width": "100%",
"text-align": "left",
"overflow": "hidden",
"border-top-width": "1px"
},
"children": [
{
"elmType": "div",
"style": {
"height": "15px",
"width": "100%",
"color": "#fff",
"font-size": "13px",
"border-top": "5px solid #eee",
"background-color": "orange",
"padding": "10px",
"visibility": "=if([$Column1]=='A', 'visible', 'hidden')"
},
"children": [
{
"elmType": "div",
"txtContent": "=if([$Column2] == '1' ||[$Column2] == '2', ' Dog ', 'Cat')"
}
]
}
]
}
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP UK (and classic 1967 Morris Traveller driver)