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

Set value of a Dropdown to same value of prior dropdown

Hello everybody,

 

I am having a hard time figuring out how to solve the following issue.

 

We have an app with four dropdowns (linked to an SharePoint list). We would like to have the following behaviour. If a person selects a value for the first dropdown, the dropdowns below also get the same value assigned. (e.g. Value of dropdown 2 is Value of dropdown 1, Value of dropdown 3 is Value of dropdown 2, Value of dropdown 4 is Value of dropdown 3.)  So when a user selects "option1" from the dropdown all other dropdowns should also get the value "option1". (All dropdowns contain the same values so this is not an issue).

 

The main issue is that I am not able to figure out how I can set the value of one dropdown based on the value of another dropdown.

 

Hope someone can point me in the right direction!

 

Regards,

 

Lucas

 

I've put my associate in copy to keep him in the loop: @MarcJanssen

3 REPLIES 3
CarlosFigueira
Power Apps
Power Apps

You can use the Default property of the (dependent) dropdowns that you want to change based on the value of the first dropdown. For example, in the example below:

ForumPost001.PNG

All dropdowns have the same Items value. The Default property of the second dropdown is set to the selected value of the first dropdown, so that when it changes, it will also update the selection of the second dropdown (but not the other way around). Likewise, the third and fourth dropdowns have similar values for their Default properties, as shown below:

Dropdown1.Items: [1, 2, 3, 4, 5]
Dropdown2.Items: [1, 2, 3, 4, 5]
Dropdown2.Default: Dropdown1.Selected.Value
Dropdown3.Items: [1, 2, 3, 4, 5]
Dropdown3.Default: Dropdown2.Selected.Value
Dropdown4.Items: [1, 2, 3, 4, 5]
Dropdown4.Default: Dropdown3.Selected.Value

If you change the selection on the first dropdown, the value of the second dropdown will be changed as well (since its Default value changed); this will also cause the third dropdown to change (since its Default value changed when the value of the second dropdown changed), and likewise for the fourth dropdown.

 

Notice that the propagation of the changes (in the example above) only happens in the top-down direction. If the user changes the value of Dropdown3, then only the selection of the Dropdown4 will be changed, but the first two are not affected.

 

You can play around with the default values to change the priority in which one dropdown will influence the others.

Hi Carlos,

 

thanks for the elaborate explanation, unfortunately I do not get it to work for my example and I assume it's because I am working with dropdowns related directly to a SharePoint List. I did manage to mimic the design below with OOTB dropdown controls, but I am not able to replicate it with SharePoint related dropdown controls. When applying the same logic I get the following message in the drop down :

 

#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference

 

Also when going through the attributes of the control I notice there is no .items attribute available. I assume this is related to the issue.

 

Any further suggestions how I could get this to work in this scenario?

 

Regards,

 

Lucas

 

Hi @LucasLaumans,

 

The dropdown auto-generated for the lookup fields is not like the dropdown control that we could add from the Insert tab.

The Lookup dropdown could be used as a search box, and would contain some different properties than the dropdown which we could add, and currently, there is no proper way to add it in a custom way.

 

The lookup field is defined as record type under PowerApps, the "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference" is one of the record item "@Odata.type".

And the detault property would display the first item of the record, which is the message you posted

"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference" is one of the record item"

 

See here for more details regarding lookup fields:

Introducing support for lookups and a new sample app

 

For the scenario you mentioned, if only the data needed, we could take use of the Text box to reference the previous dropdown value, replace the dropdown 2 to 4 with Textbox, and set its value with the dropdown1.selected.value.

For People column, the formula should be:

dropdown1.selected.Email

Or 

dropdown1.selected.DisplayName

 

If value selecting is needed for field 2 to 4, would it be convenient to add a corresponding TextBox besides those dropdown, to act as a reference?

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (56,015)