cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

How to Clear Gallery after Navigating to Home Screen

Hi -

I was able to navigate from one screen to another and clear the fields using:

Screen1: Navigate(CompoundingRecord,None) & Reset(SearchBox) & Reset(Gallery1)

Screen2: Navigate(HomeScreen, ScreenTransition.Fade) & Reset(SearchBox) & Reset(Gallery1)

Item on Screen2: was Gallery1.Selected but now I changed to 

 

Item on Screen2 to: Filter(DrugTBL,ID=conDrugID)

 

What should I put in place of Resect(Gallery1). I have the galleries defaulted as {}

 

Thank you

 

6 REPLIES 6
Highlighted
Frequent Visitor

Save your results in a collection if not already built that way.

 

Afterwards you can clear() your collection at e.g. onVisible or at onHidden or with a button.

 

If this does not help you, screenshots etc. are always quite helpful to understand the problem better.

Highlighted
Microsoft
Microsoft

Hi@Bunly11,

Based on the issue that you mentioned, do you want to clear the content from the Gallery1 after navigating to the HomeScreen?

Could you please share a bit more about the scenario:

  1. Is there an EditForm in the HomeScreen, how you configure the HomeScreen? 
  2. What is the data type of the 'conDrugID'?

I have a test on my side, please take a try as below.

Set the OnSelect property of the reset button as below:

 

Navigate(HomeScreen, ScreenTransition.Fade)&&Set(ResetGallery,false)&&Reset(SearchBox)

 

Set the Items property of the Gallery1 as below:

 

If(ResetGallery,Filter(DrugTBL,ID=conDrugID))

 

Best Regards,

Qi

Highlighted

Hi @v-qiaqi-msft 

Is there an EditForm in the HomeScreen, how you configure the HomeScreen?  I use the notebook icon to navigate from HomeScreen to CompoundingRecord.

Capture.JPG

 
 
 

What is the data type of the 'conDrugID'? conDrugID is the primary key on from a Sharepoint list.

 

I want to clear content of Gallery2 on CompoundingRecord when I navigate to Homescreen.  I was able to do this when I had Gallery2 = Gallery 1.Selected but when I changed to Gallery2 to Filter(DrugTBL,ID=conDrugID) the naviagtion no longer works.

 

Bunly11_0-1600833770941.png

 

I am not sure if I should just use gallery1.selected again? I was trying to get rid of an inefficient delay loading but seem to have created more problems. 

 

Thanks again

 

Highlighted

Hi @HendrikKl -

I do not know how to save my results in a collection. How do you create a collection?

 

Thanks

Highlighted

Hi@Bunly11,

Based on your need, I think a collection may be a better and efficient solution.

Add a Button and set the OnSelect property  as below:

 

ClearCollect(Col1, Filter(DrugTBL,ID=conDrugID))

 

Set the OnSelect property of the navigation button as below:

 

Navigate(CompoundingRecord);Clear(Coll);Reset(SearchBox)

 

Set the Items property of the Gallery2 as below:

 

Col1

 

Please check if the above formula could solve your problem.

 

Best Regards,

Qi

Highlighted

Hi @v-qiaqi-msft 

 

I added button to Homescreen but is there a way to not have this button? 

Bunly11_0-1600882451611.png

But when I navigate to CompoundingRecord it is now blank. I am not sure what to change below to get the selected ID to display

Navigate(CompoundingRecord, ScreenTransition.Fade, {conDrugID:ThisItem.DrugID})

Bunly11_1-1600882611046.png

 

Thank you again.

I really appreciate everyone's input as I am learning powerapps via this forum, the school of Google, and Youtube.

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (15,798)