SOLVED

conditional json formatting for form footer - basic

Deleted
Not applicable

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.  

2 Replies
best response
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)

@Rob_Elliott Thank you! Works perfect.
1 best response

Accepted Solutions
best response
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)

View solution in original post