cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rob_CTL
Helper V
Helper V

Selective screen resets depending on navigation source?

Hi,

 

I have an app that has a search box on the screen, there is a gallery that reacts to the words that are entered into the search box.  When the screen loads I reset the search box so it hides the gallery and the user has a clean interface to search from.  The items in the gallery have a button that navigates to another screen, this new screen uses the selected item from the search screen to display data.  All straightforward so far.

 

Now the complicated bit, I want to change the on visible of the search screen to react differently depending where the user has navigated from.  By this I mean if the user clicks a button from a different page within the app to go to the search page it will load and reset the search box so that the interface is clean.  However if the user has performed their search and clicked on an item and presses a "Back" button it should return them to the search screen but this time it doesn't execute the reset on the search box so their previous search results are still visible.

 

I've been playing with UpdateContext but this doesn't appear to work across screens, or at least I can't get it to work across screens.

 

Any help or thoughts gratefully received.

Rob

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Rob_CTL 

You can actually utilize the context variable for this.  If your search screen uses a context variable such as lclResetScreen to determine if the screen should be reset, then you can pass this back from another screen.  You can't use the Back() function on your other screens, but you can use the Navigate to do so.

Ex.  Navigate(yourSearchScreen, None, {lclResetScreen:false})

This will set the context variable on the search screen to false.

Perhaps you can work this into your thought process.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@Rob_CTL 

You can actually utilize the context variable for this.  If your search screen uses a context variable such as lclResetScreen to determine if the screen should be reset, then you can pass this back from another screen.  You can't use the Back() function on your other screens, but you can use the Navigate to do so.

Ex.  Navigate(yourSearchScreen, None, {lclResetScreen:false})

This will set the context variable on the search screen to false.

Perhaps you can work this into your thought process.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Rob_CTL
Helper V
Helper V

@RandyHayes ah, lightbulb moment - thanks that really helped point me in the right direction

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,503)