cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AlbertoSP
Advocate II
Advocate II

If Statment using AND

What is the syntax for using And  in an if statment?

Need a button disabled if 2 condition are met

if fld_Generic.Text - "ABC"  AND IsBlank(fld_Relation.Selected.Value)

Then disable the button (DisplayMode.Disabled).

Thanks in Advance

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

Hi @AlbertoSP 

The syntax looks like this:

If(And(fld_Generic.Text="ABC", IsBlank(fld_Relation.Selected.Value)), 
DisplayMode.Disabled,
DisplayMode.Edit
)

You can also use the && syntax like this:

If(fld_Generic.Text="ABC" && IsBlank(fld_Relation.Selected.Value), 
DisplayMode.Disabled,
DisplayMode.Edit
)

 

View solution in original post

4 REPLIES 4
timl
Super User
Super User

Hi @AlbertoSP 

The syntax looks like this:

If(And(fld_Generic.Text="ABC", IsBlank(fld_Relation.Selected.Value)), 
DisplayMode.Disabled,
DisplayMode.Edit
)

You can also use the && syntax like this:

If(fld_Generic.Text="ABC" && IsBlank(fld_Relation.Selected.Value), 
DisplayMode.Disabled,
DisplayMode.Edit
)

 

rajmilansinh
Advocate V
Advocate V

Hey there,

 

So achieve this functionality you have to write if function in button's "DisplayMode" property.

Please refer bewlow screenshot to get more idea on this:

 

disable button.png

Code as per your field and requirement: 

if(fld_Generic.Text = "ABC" &&  IsBlank(fld_Relation.Selected.Value), DisplayMode.Disabled, DisplayMode.Edit)

 

Please mark this as a solution if really helps you.

 

Thanks,

Milansinh Raj

Thank you.

Although the second solution using &&, doidn't seem to work

May I know which connection you are using here ? Dynamics CRM connector or CDS connection ?

Because I have created demo app screen to show solution and I am using Dynamics CRM Connector here.

It is working fine for me.

Let me know so I can get knowledge in which case it cant be work

Smiley Happy

 

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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,564)