cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AlbertoSP
Helper II
Helper 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 III
Super User III

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 III
Super User III

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,678)