cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

reset dropdown when row has been removed

Hi,

 

I have a dropdown that I want to be able to automatically removed once a row is removed from the table. There's a button I click on to remove the row but once its removed, The removed row still shows as a default with a X next to it in the dropdown box. I want it to disappear totally and default to the next available row.

 

I'm using the update context variable but I'm not sure if that's the best way to go.

6 REPLIES 6
Highlighted
Super User
Super User

Re: reset dropdown when row has been removed

Hi oria5467, 

 

Just want to make sure I understand your question right: You have a dropdown of say 5 values. There's a button that when clicked that removes one of the items in the dropdown (say 1st as an example). But once its removed, the removed row still shows as a default with a X next to it in the dropdown box. A few questions:

 

1. How are you populating the dropdown? Is it an option set or a collection or simply a set of text values? 

2. Can you provide the expression that you are using to remove the item from the dropdown? 

 

In the meantime, I am going to try this and let you know how I make it work. 

Highlighted
Anonymous
Not applicable

Re: reset dropdown when row has been removed

1. How are you populating the dropdown? Is it an option set or a collection or simply a set of text values? 

On change: Set(selectedvalue,First(Filter('[dbo].[BPATLoadStaging]',SourceName=Dropdown7.Selected.Result))); Dropdown 7 is the primary key drop down and source name is another dropdown that depends on dropdown 7 to populate.

Items: '[dbo].[BPATLoadStaging]'

Defaultseleteditems: selectedvalue

2. Can you provide the expression that you are using to remove the item from the dropdown? 

I pretty much set the reset property on the dropdown  7 to "resetprojectcodevar" and added *update({resetprojectcodevar: true})* to the *delete row button* on select property.

The dropdown is pretty much filtering a form.

Highlighted
Super User
Super User

Re: reset dropdown when row has been removed

I had prepared this example, so sharing it although not sure if its the same as yours (I will review yours after this one and add another example): 

 

I have a dropdown that is populated with a collection (which is being defined by a button): ClearCollect(DropdownCollection, "Value 1", "Value 2", "Value 3")

 

I then have a dropdown with this collection as the data source

 

I have another button that removes the 1st time. When I hit that button, the item gets removed and the dropdown defaults to the 2nd value. I have recorded a video as well: Here is the link: https://drive.google.com/file/d/1hHa7F82RIqMjMuvTDh8d3ZAlg_H480Wf/view?usp=sharing 

Highlighted
Super User
Super User

Re: reset dropdown when row has been removed

Are you using a dropdown or a combobox? 

Highlighted
Anonymous
Not applicable

Re: reset dropdown when row has been removed

combobox. 

Highlighted
Super User
Super User

Re: reset dropdown when row has been removed

Just making sure I got it right:

 

1. So you have a combo box that is populated with Items property as Items: '[dbo].[BPATLoadStaging]'

2. For that same combo box, the DefaultSelectedItems property is Defaultseleteditems: selectedvalue

3. The reset property of the combo box is resetprojectcodevar

4. The button to remove a value has its OnSelect as update({resetprojectcodevar: true})

 

So 2 questions: 

1. How are you "removing" a value or do you just want to reset the combo box to select a default value? 

2. Is there a specific reason why you are using a combo box vs a dropdown? 

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (9,094)