cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Conditional visibility - dropdown box

Hello,

 

I want to make a button visible if any one of several dropdown values is selected. I was trying to build up the statement using the Or/ || syntax but this isn't working.

 

Here is the example of what I tried:

 

If ("Text from Dropdown 1"||"Text from Dropdown 2" in Dropdown1.Selected.Value, true)

 

 

Is it possible to set the button's visibility based on one statement, or do I need a multiple instances of the button each with one statement for each condition that makes it visible?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Continued Contributor
Continued Contributor

If( Dropdown1.Selected.Value = "condition1" || Dropdown1.Selected.Value = "condition2", true, false)

 

Try that 🙂

 

Sean

 

 

 

 

View solution in original post

Responsive Resident
Responsive Resident

You can go about this a few ways.

 

The simple approcah is:

In the button's Visible control field:

 

If(Dropdown.Selected.Value="Text from Dropdown 1", true,false)

 

Perhaps you need to create another list to assist you in your rules. You can compare values without the need to keep adjusting the syntax, it a lot more managable.

Then you can create syntax on a filter to show the button.

 

Create another list for example with 1 column, then create a collection from that. Collect(ButtonKeywordsCollection,'ButtonKeywords')

Title: ButtonKeywords

Now on the buttons Visible control field:

 

if(Dropdown.Selected.Value = Lookup(ButtonKeywordCollection,Dropdown.Selected.Value = Column1,Column1,true,false))

if(Dropdown.Selected.Value || Dropdown2.Selected.Value = Lookup(ButtonKeywordCollection,Dropdown.Selected.Value = Column1,Column1,true,false))

This syntax may be different from SharePoint list and an excel sheet.

 

You can come up with methods like this is you think inline syntax will get too unmanageable.

 

View solution in original post

10 REPLIES 10
Continued Contributor
Continued Contributor

If( Dropdown1.Selected.Value = "condition1" || Dropdown1.Selected.Value = "condition2", true, false)

 

Try that 🙂

 

Sean

 

 

 

 

View solution in original post

Responsive Resident
Responsive Resident

You can go about this a few ways.

 

The simple approcah is:

In the button's Visible control field:

 

If(Dropdown.Selected.Value="Text from Dropdown 1", true,false)

 

Perhaps you need to create another list to assist you in your rules. You can compare values without the need to keep adjusting the syntax, it a lot more managable.

Then you can create syntax on a filter to show the button.

 

Create another list for example with 1 column, then create a collection from that. Collect(ButtonKeywordsCollection,'ButtonKeywords')

Title: ButtonKeywords

Now on the buttons Visible control field:

 

if(Dropdown.Selected.Value = Lookup(ButtonKeywordCollection,Dropdown.Selected.Value = Column1,Column1,true,false))

if(Dropdown.Selected.Value || Dropdown2.Selected.Value = Lookup(ButtonKeywordCollection,Dropdown.Selected.Value = Column1,Column1,true,false))

This syntax may be different from SharePoint list and an excel sheet.

 

You can come up with methods like this is you think inline syntax will get too unmanageable.

 

View solution in original post

Regular Visitor

Works beautifully. Thanks so much, Sean.

This is very clever and works great. Thanks Nick!

Hey,

 

I tried this formula bit this didn't work for me? 

Does anybody knows what i mdoing wrong? 

 

 

 

Dont referene the DataCard. but the DataCard Value i.e Dropdown.value

  1. Find out the name of the dropdown control in the datacard and change it to better reference, ill use 'DropDownControl1'. I usually replace all controls like this DataCard_MyABBR, DataCardKey_MyABBR, DataCardValue_MyABBR
  2. Check the lookup values in the DropDown control. If they reference another list like
    1. [0,1,2,3,4,5,6] then it will be DropDownControl.Value because its a number type.
    2. ["Item1","Item2","Item3","Item4"] then it will be text. You need to reference the column DropDownControl.Column (DropDownControl.ItemName)
    3. If its static items that you entered in its a single colum ["Item1","Item2","Item3","Item4"] so it will be .Value

If(DropDownControl.Column = "Station", true, false)

 

You can get quite complex if you need by doing things like so.

 

If(DropDownControl.Column in ["Station","Shop","Park], true, false)

If(DropDownControl.Column in ReferenceCollection.Items, true, false)

 

New Member

If you have multiselect dropdown values and you want to have conditional visibility you can use the following condition in visible property of that Card or whatever,

 

If(CountIf(DataCardValue.SelectedItems,Value="Selection Required")>0,true,false)


@bean wrote:

If( Dropdown1.Selected.Value = "condition1" || Dropdown1.Selected.Value = "condition2", true, false)

 

Try that 🙂

 

Sean

 

 

 

 


How would I go about doing this if I am referencing a datacard from a Form? 

example:

Form: Form5,

DataCard: Test Data Card,

DataCardValue: DataCardValue76. 

I have a multi-select dropdown DataCardValue47 containing values (Individual, Third Party, Contractors). 

 

I want to show/hide DataCard1 when

Selected values in the DataCardValue47 are Individual, Third Party, Contractors

OR

Individual, Third Party

OR

Individual, Contractors)

OR

Individual

 

Don't show when selected values are 

Third Party, Contractors

Third Party

Contractors

 

Visible

If(DataCardValue47.Selected.Value = "Individual", true, false) --- This condition works fine.

Please advise the correct logic. 

 

Logic i was trying
If(DataCardValue47.Selected.Value = "Individual", true, false) ||

If(DataCardValue47.Selected.Value in ["Individual","Third Party","Contractors"] but data card still shows when i just select Third Party or Contractors

 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (36,786)