Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data binding to boolean fails #4350

Closed
IntranetFactory opened this issue Jul 10, 2020 · 6 comments
Closed

data binding to boolean fails #4350

IntranetFactory opened this issue Jul 10, 2020 · 6 comments
Labels

Comments

@IntranetFactory
Copy link

I have the following simple payload

{
    "title": "boolean binding",
    "visible": false
}

and the following simple card definition

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.2",
    "body": [
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "${title}",
                    "isVisible": "${visible}"
                }
            ]
        }
    ]
}

I cannot bind visible

"isVisible": "${visible}" still shows the TextBlock
"isVisible": ${visible} isn't valid JSON so the card

@dclaux
Copy link
Member

dclaux commented Jul 10, 2020

@IntranetFactory I assume this is a designer issue. In the future, please make sure you specify that.

I can repro in the designer. Note this issue will not repro if you use the templating SDK in your own code. It is a designer specific issue.

@dclaux
Copy link
Member

dclaux commented Jul 10, 2020

To be more explicit - the designer currently has limited data binding support. Aside from the properties that can be explicitly bound, other things might not work as expected, and that includes Boolean properties.

I will look into fixing this specific use case (e.g. binding Boolean properties) but other limitations will still exist and you might still hit them. Comprehensive data binding support in the designer is on the roadmap but it is a significant work item.

@IntranetFactory
Copy link
Author

IntranetFactory commented Jul 10, 2020

It is a designer specific issue.

What syntax should be used to bind a boolean property in my own card template?

a. "isVisible": "${visible}" I think that this won't work, as the result is a string
b. "isVisible": ${visible} I assume this should work - but a file containing that expression isn't a valid json file

@dclaux
Copy link
Member

dclaux commented Jul 10, 2020

"isVisible": "${visible}" is the correct syntax. The result isn't a string. It is the type of the binding expression, ${visible}, which in your case is a Boolean. "isVisible": ${visible} isn't valid JSON to start with and would cause the entire payload to fail parsing.

@dclaux
Copy link
Member

dclaux commented Jul 10, 2020

I have a PR that fixes this: #4351

@ghost
Copy link

ghost commented Jul 10, 2020

Hi @IntranetFactory. We have acknowledged this issue report. Please continue to follow this issue for updates/progress/questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants