cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MikeAnderson
Level: Powered On

Reset Combobox in Preview (F5) no working?

Hello,

 

I'm new to PowerApps and have an issue I can't figure out.  I have two (2) combo boxes that are pulling from two (2) different tables in SQL.

 

Cbo1 - Simply pulls the values from a decription field

Cbo2 - Is filtered based on Cbo1 selection like this:

 

Filter('[dbo].[EMCM]', udCategoryGroup = boBoxCategoryLookup.Selected.Description)

This all works great.  Here is my issue, I also want the selected values in both combo boxes to reset after navigating off the screen or on run.  I thought that setting the Screen.OnVisible to this would do the trick:

Reset(CboBoxCategoryLookup)

But when I press F5, the previously selected values are still there.  I tried setting this on App.OnStart but again no luck.

 

How do I reset the combo box selections to the default InputTextPlaceholder value?

 

Thanks!

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Reset Combobox in Preview (F5) no working?

@MikeAnderson 

Ah, I see the issue - you were expecting the OnVisible would execute when you "run/play" the app.  This is not correct.  OnVisible will only execute when the screen becomes visible - in other words, when that screen becomes the current screen after being on another screen (or nothing).  

If you click on your AllRequestsScreen and then back to the EquipmentRequestScreen, then your OnVisible will execute.

Also, as mentioned before, the App.OnStart will only execute when the App starts, although you can (in the designer) choose to run the OnStart.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

7 REPLIES 7
Super User
Super User

Re: Reset Combobox in Preview (F5) no working?

@MikeAnderson 

What is it that you want the comboboxes to set to?  When you initiate a reset on a ComboBox, the formula that you have in the DefaultSelectedItems property of the comtrol comes into play. 

What is it that you have in that property and is it what you are trying to change?  You mentioned that you wanted the selected items to "reset"...reset to what?  That is what is controlled in the DefaultSelectedItems property formula.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
MikeAnderson
Level: Powered On

Re: Reset Combobox in Preview (F5) no working?

Hey Randy,

 

The documentation states the Reset function resets a control to its Default property, any user changes are discarded.  The Default property of a combo box is blank, so I assumed reset would reset it to blank?  Does Reset not use the Default property value of a combo box?  The DefaultSelectedItems property is also the default value of blank as well. These are default combo boxes minues the data source and filter of the second combo box.

 

I have a selected value in the combo box, and I want it to reset to blank.  I would like both combo boxes to go back to the default state where it shows the value of the InputTextPlaceholder property "Select Items".  Or at least that's what I'm trying to do.

 

Does that make sense?

Super User
Super User

Re: Reset Combobox in Preview (F5) no working?

@MikeAnderson 

Yes, the reset function may be misleading in that case as the DefaultSelectedItems plays a huge roll in the reset of a ComboBox.

However, if that property is empty and there are no other changes to your ComboBox (other than you obviously changed the InputTextPlaceholder property), then what you are describing should be working properly.

As it is, you should be able to have a ComboBox on your screen with the appropriate Items set to a datasource.  It should be empty at this point (nothing selected).  You can test by putting a button on your screen with the action of Reset(yourComboBox)  You can then select items in your combobox and then press the button...it should absolutely reset to blank (nothing selected).

Try to put a button on your screen as mentioned and see if you see results from that.  If so, then I would suspect an issue with where you are trying to put the reset function before (definitely not in the OnStart action as that will only happen once when the app starts).  

See where you get with the test.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
MikeAnderson
Level: Powered On

Re: Reset Combobox in Preview (F5) no working?

Here are the results (with screenshots to prove my sanity):

 

Here are the default property values:

1.png

 

Here is where call Reset (does this maybe need to be called somewhere else? I was assuming that when I F5 .OnVisible gets called, but clearly this is not happening)

2.png

 

Press F5, value still there:

3.png

 

Call Reset Button which calls Reset(CboBoxCategoryLookup) and it works:

4.png

Highlighted
Super User
Super User

Re: Reset Combobox in Preview (F5) no working?

@MikeAnderson 

Ah, I see the issue - you were expecting the OnVisible would execute when you "run/play" the app.  This is not correct.  OnVisible will only execute when the screen becomes visible - in other words, when that screen becomes the current screen after being on another screen (or nothing).  

If you click on your AllRequestsScreen and then back to the EquipmentRequestScreen, then your OnVisible will execute.

Also, as mentioned before, the App.OnStart will only execute when the App starts, although you can (in the designer) choose to run the OnStart.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

MikeAnderson
Level: Powered On

Re: Reset Combobox in Preview (F5) no working?

Make sense, is there a property that will get me the desired results without having to use a button.  It's just for some sanity testing but it would be nice if I didn't have to push a button.

 

Thanks for your insight!

Super User
Super User

Re: Reset Combobox in Preview (F5) no working?

@MikeAnderson 

So in your original question you mentioned that "I also want the selected values in both combo boxes to reset after navigating off the screen or on run."

 

So, if that is the case then there is no need for a button - that was just to test.  If you want to reset the control when you navigate away from the screen, then put the Reset function in the OnHidden action of the screen.  As for "on run", it should be reset when you run the app for the first time anyway since you have no other controlling properties in the defaults.

 

The challenge with the OnHidden and the OnVisible actions of the screens when designing, is that you have to select another screen and then reselect the current screen to get them to run.  

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 361 members 7,076 guests
Recent signins:
Please welcome our newest community members: