cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Davy1
Regular Visitor

Using If statement for visible

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Davy1
Regular Visitor

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

Thank you 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

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
Regular Visitor

Hi Axel,

 

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

Davy1_0-1613663469265.png

 

Anonymous
Not applicable

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
Regular Visitor

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

Davy1
Regular Visitor

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

Thank you 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (4,061)