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
)

 

View solution in original post

rajmilansinh
Advocate IV
Advocate IV

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,485)