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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (45,500)