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

Populating dropdown value based on other dropdown

Hi there,

 

I am quite new to PowerApps so my apologies for this rather simple question.

I have 6 dropdowns with the same items in all of them: "Chosen" and "Rejected". All dropdowns are named Dropdown1, Dropdown2 etc.
If I select Chosen in one of the dropdowns, I want the rest of the dropdowns to automatically select "Rejected", vice versa if I change a Rejected dropdown to Chosen, the whole operation starts again.

How would you solve this? I tried to look at default values but without any luck 😞

Thanks in advance,

 

/Casper

2 ACCEPTED SOLUTIONS

Accepted Solutions
JR-BejeweledOne
Super User
Super User

Here you go.

 

On your app load set a variable like this where 'Dropdowns' is the name of the variable:

Set(
    Dropdowns,
      {
        Dropdown1: false,
        Dropdown2: false,
        Dropdown3: false,

        Dropdown4: false,

        Dropdown5: false,

        Dropdown6: false
     }
)

 

On each of your dropdowns use this formula changing it as needed based on which dropdown you are setting.

Dropdown1 would be:

 

If(
Dropdown1.Selected.Value = "Chosen", Set(Dropdowns, {Dropdown1: true, Dropdown2: false, Dropdown3: false, Dropdown4: false, Dropdown5: false, Dropdown: 6 false})

)

 

Dropdown2 would be:

 

If(
Dropdown2.Selected.Value = "Chosen", Set(Dropdowns, {Dropdown1: false, Dropdown2: true, Dropdown3: false, Dropdown4: false, Dropdown5: false, Dropdown: 6 false})

)

 

And so on for each dropdown.

 

Set the default property for each dropdown:

So the default property for Dropdown1 would be:

If(
Dropdowns.Dropdown1 = false, "Rejected",
Dropdowns.Dropdown1 = true, "Chosen",
Dropdowns.Dropdown1 = false & Dropdowns.Dropdown2 = false & Dropdowns.Dropdown3 = false & Dropdowns.Dropdown4 = false & Dropdowns.Dropdown5 = false & Dropdowns.Dropdown6 = false,

""
)   

 

And the default property for dropdown2 would be:

 

If(
Dropdowns.Dropdown2 = false, "Rejected",
Dropdowns.Dropdown2 = true, "Chosen",
Dropdowns.Dropdown1 = false & Dropdowns.Dropdown2 = false & Dropdowns.Dropdown3 = false & Dropdowns.Dropdown4 = false & Dropdowns.Dropdown5 = false & Dropdowns.Dropdown6 = false,

""
)

 

And so on.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

JR-BejeweledOne
Super User
Super User

My apologies.   I give you this elaborate setup and forgot to tell you where to use it!   Yes it is used in the OnChange property.

 

I also see an error I needed to fix in the example for the dropdown2 default formula.  It should have read (and I will fix it for others to see):

 

And the default property for dropdown2 would be:

 

If(
Dropdowns.Dropdown2 = false, "Rejected",
Dropdowns.Dropdown2 = true, "Chosen",
Dropdowns.Dropdown1 = false & Dropdowns.Dropdown2 = false & Dropdowns.Dropdown3 = false & Dropdowns.Dropdown4 = false & Dropdowns.Dropdown5 = false & Dropdowns.Dropdown6 = false,

""
)



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

8 REPLIES 8
JR-BejeweledOne
Super User
Super User

In your default items for each control you will need a formula similar to this:  Each control will have 5 statements to evaluate and will reference the other 5 controls.

 

Here are 2 ways you could do this:  This one would be set on Dropdown1 (On dropdown2, you would be referencing dropdowns 1, 3,4,5,6 and so on for each subsequent control)

 

If( Dropdown2.Selected.Value = "Chosen" Or Dropdown3.Selected.Value = "Chosen" Or Dropdown4.Selected.Value = "Chosen" Or Dropdown5.Selected.Value = "Chosen" Or Dropdown6.Selected.Value = "Chosen", "Rejected", "")

 

If(

   Dropdown2.Selected.Value = "Chosen", "Rejected",

   Dropdown3.Selected.Value = "Chosen", "Rejected",

   Dropdown4.Selected.Value = "Chosen", "Rejected",

   Dropdown5.Selected.Value = "Chosen", "Rejected",

   Dropdown6.Selected.Value = "Chosen", "Rejected",

   ""

)



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Thanks for the tip!

I tried to do that, inserted the first If formula in the defaults value of dropdown1 with success. But I get circular reference errors when I try and insert the changed formula on dropdown2 and the other ones. Don't really see how to fix that 😞


JR-BejeweledOne
Super User
Super User

I will see if I can figure it out.   Other than this are these dropdowns dependent on each other at all?   Is the items property for each ["Chosen", "Rejected"] or are they getting the values from a data source?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
JR-BejeweledOne
Super User
Super User

Here you go.

 

On your app load set a variable like this where 'Dropdowns' is the name of the variable:

Set(
    Dropdowns,
      {
        Dropdown1: false,
        Dropdown2: false,
        Dropdown3: false,

        Dropdown4: false,

        Dropdown5: false,

        Dropdown6: false
     }
)

 

On each of your dropdowns use this formula changing it as needed based on which dropdown you are setting.

Dropdown1 would be:

 

If(
Dropdown1.Selected.Value = "Chosen", Set(Dropdowns, {Dropdown1: true, Dropdown2: false, Dropdown3: false, Dropdown4: false, Dropdown5: false, Dropdown: 6 false})

)

 

Dropdown2 would be:

 

If(
Dropdown2.Selected.Value = "Chosen", Set(Dropdowns, {Dropdown1: false, Dropdown2: true, Dropdown3: false, Dropdown4: false, Dropdown5: false, Dropdown: 6 false})

)

 

And so on for each dropdown.

 

Set the default property for each dropdown:

So the default property for Dropdown1 would be:

If(
Dropdowns.Dropdown1 = false, "Rejected",
Dropdowns.Dropdown1 = true, "Chosen",
Dropdowns.Dropdown1 = false & Dropdowns.Dropdown2 = false & Dropdowns.Dropdown3 = false & Dropdowns.Dropdown4 = false & Dropdowns.Dropdown5 = false & Dropdowns.Dropdown6 = false,

""
)   

 

And the default property for dropdown2 would be:

 

If(
Dropdowns.Dropdown2 = false, "Rejected",
Dropdowns.Dropdown2 = true, "Chosen",
Dropdowns.Dropdown1 = false & Dropdowns.Dropdown2 = false & Dropdowns.Dropdown3 = false & Dropdowns.Dropdown4 = false & Dropdowns.Dropdown5 = false & Dropdowns.Dropdown6 = false,

""
)

 

And so on.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Thank you for this! Working with a global variable makes sense!

I have one question that I do not fully understand; you wrote that: "On each of your dropdowns use this formula changing it as needed based on which dropdown you are setting"

Where exactly do I change this formula? OnSelect, OnChange or? It cannot be the default property, since this is another formula 🙂

JR-BejeweledOne
Super User
Super User

My apologies.   I give you this elaborate setup and forgot to tell you where to use it!   Yes it is used in the OnChange property.

 

I also see an error I needed to fix in the example for the dropdown2 default formula.  It should have read (and I will fix it for others to see):

 

And the default property for dropdown2 would be:

 

If(
Dropdowns.Dropdown2 = false, "Rejected",
Dropdowns.Dropdown2 = true, "Chosen",
Dropdowns.Dropdown1 = false & Dropdowns.Dropdown2 = false & Dropdowns.Dropdown3 = false & Dropdowns.Dropdown4 = false & Dropdowns.Dropdown5 = false & Dropdowns.Dropdown6 = false,

""
)



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Thank you very much!

I think this solved it - even though I have some 'errors', it at least now works every time I select "chosen".

Excellent suggestion and help!

JR-BejeweledOne
Super User
Super User

If you don't mind me asking, what 'errors' are you seeing?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
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.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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