web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using If statement for...
Power Apps
Answered

Using If statement for visible

(0) ShareShare
ReportReport
Posted on by 59

Hi Experts,

 

I am trying to hide some labels in the Gallery and some datacards in the edit form based of a value in another field. When I go to the visible property and write something like, If(ThisItem.Allowed=yes,true,false), it throws me an error, right on the equal to sign, I am not able to get past this point. I am not able to do If(ThisItem.Allowed.Value=yes,true,false) too as when I use a period after Allowed (If(ThisItem.Allowed.) nothing comes up. Also if I try to assign the field to a label, it shows the value when I use ThisItem.Allowed in the text property of the label

 

Please help. This is embedded canvas app for D365.

 

Thanks in advance for your response.

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello,

     

    Try with double quote like this :

     

    If(ThisItem.Allowed="yes",true,false)

     

     

    Or try to use an update context, ex :

     

    UpdateContext({showItem: false})

     

    And set the visible Properties of your items with: showItem

    Depend on your action, you can change the show value with a onselect properties or other one:

     

    UpdateContext({showItem: true})

     

  • Davy1 Profile Picture
    59 on at

    Hi Axel,

     

    Thank you for the response, When I use double quotes, I get the below error.

    Davy1_0-1613663469265.png

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I don't really understand what is the "Allowed" you try to use.

    If "Allowed" is supposed to be the Text to show or hide your items, you should try this in your labels and datacards :

     

    Visible = If(TextInput1.Text = "Allowed";true;false)

     

    Where TextUnput1 is your widget name for text input.

     

  • Davy1 Profile Picture
    59 on at

    Hi Axel,

    Sincere Apologies for confusing you. The field name is "AllowXXXXX" but I masked it as "Allowed". Its a field, an option set with two values, yes and no. I have masked it in the screenshot as well.

    Thanks again for your response

  • Verified answer
    Davy1 Profile Picture
    59 on at

    I got this working by using If(Text(ThisItem.Allowed)="Yes",true,false).

    Thank you 

  • TheConductor Profile Picture
    6 on at

    I can't get the following to work... If(Text(DataCardValue1.SelectedItems)="OTHER",true,false) 

    Where DataCardValue1 is a Combo box with multiple selections enabled

    Any suggestions?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard