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

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

 

Axel_A
Regular Visitor

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 

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (43,735)