cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Powerapps12345
Helper I
Helper I

Or-function

Hello!
I have 4 dropdown columns and one textbox. If any of those 4 dropdown columns has a value, I want the textbox to be visible. Is the "or-function" the right way to solve this? Anyone? 🙂

2 ACCEPTED SOLUTIONS

Accepted Solutions
FrostedFlake
Resolver I
Resolver I

What does "dropdown column" mean? Could you share a screenshot?

A working "AND" statement would be (in the visible property of your textbox):

 

 

If(dropDown1.Selected.Value = "" && dropDown2.Selected.Value = "" && dropDown3.Selected.Value = "" && dropDown4.Selected.Value = ""; false; true)

 

 

 

 
This will only show the textbox if a value is selected in one of your dropdowns. 🙂 

View solution in original post

 

If(dropDown1.Selected.Value = ""; false; If( dropDown2.Selected.Value <> "" || dropDown3.Selected.Value <> "" || dropDown4.Selected.Value <> ""; true; false))

@Powerapps12345 
Should work as expected  

Maybe you should check @GarethPrisk tips too.

View solution in original post

6 REPLIES 6
GarethPrisk
Resident Rockstar
Resident Rockstar

Yes. Logical operators are great for this type of scenario.

Set the Visible property of your Text Input to

Or(
    !IsBlank(Dropdown1.Selected),
    !IsBlank(Dropdown2.Selected),
    !IsBlank(Dropdown3.Selected),
    !IsBlank(Dropdown4.Selected)
)

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-logicals

 

Drop downs will always have a value, by default, but you can make AllowEmptySelection = true, and also make sure the Default doesn't resolve to a value. Otherwise, that function above may resolve as true without user input.

FrostedFlake
Resolver I
Resolver I

What does "dropdown column" mean? Could you share a screenshot?

A working "AND" statement would be (in the visible property of your textbox):

 

 

If(dropDown1.Selected.Value = "" && dropDown2.Selected.Value = "" && dropDown3.Selected.Value = "" && dropDown4.Selected.Value = ""; false; true)

 

 

 

 
This will only show the textbox if a value is selected in one of your dropdowns. 🙂 

A few comments on the sample by @FrostedFlake , for the benefit of others.

  • If your intended outcome is a True/False, then you can avoid writing an If statement that provides True for the true result, and False for the false result
    • IsBlank(DropDown1.Selected)
    • The above code inherently returns True/False
    • Otherwise, if you get into the habit of writing If statements with true/false outcomes, then your code blocks may become longer and more difficult to read/troubleshoot
  • You can invert any Boolean value with ! operator
    • This will allow you to do a check which you want to be False, but then swap/invert it to be True
  • Checking if a value = "" is not always the same as checking if it is Blank or Empty
    • Although "" is a blank/empty string, it is also a non-blank value
    • This is another one that can be accomplished other ways, and more consistently
  • Use logical operators to chain AND or OR functions together
    • This will make your code significantly easier to read and to understand

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/operators

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-isblank-isempty

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-logicals

@FrostedFlake Thanks, it worked perfectly! Is it possible to do the same thing but this time to make the textbox visible if dropdown1 and one of the other dropdows has a value? For example:
Value in dropdown1 and dropdown2 = Textbox visible
Value in dropdown1 and dropdown3 = Textbox visible
Value in dropdown1 and dropdown4 = Textbox visible

 

If(dropDown1.Selected.Value = ""; false; If( dropDown2.Selected.Value <> "" || dropDown3.Selected.Value <> "" || dropDown4.Selected.Value <> ""; true; false))

@Powerapps12345 
Should work as expected  

Maybe you should check @GarethPrisk tips too.

@FrostedFlake Your formula worked fine, thanks again!

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,062)