web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : UTy9Y6ezhjTMtlUtbuzug3
Power Apps - Building Power Apps
Unanswered

Reset gallery when entering screen

Like (0) ShareShare
ReportReport
Posted on 20 Jan 2020 21:17:21 by 55

I have a report screen where users can select a report to view. When they navigate to that screen, the gallery is remembering the results from the previous visit. The dropdown box is what populates the gallery. 

 

I currently have the navigation set to:

 

Navigate(StatusScreen); Reset(dd_CurrentStatus_1); Reset(ReportGallery_2)
 
Do I need to add a variable too?
 
Thanks!
Categories:
  • rebeccas Profile Picture
    2,591 on 21 Jan 2020 at 18:49:29
    Re: Reset gallery when entering screen

    I missed that. If that is the case you don't need the If statement. 

     

    So:

     

    OnVisible:

    UpdateContext({ResetCombo:!ResetCombo})

     

    ComboBox:

    Allow multiple selections - Off

    Allow Searching - On

    Items - Choices(DataSource.FieldName)

    Reset - ResetCombo

     

    Gallery:

    Sort(Filter(DataSource, FieldName.Value=ComboBox1.Selected.Value),"SortField",Ascending)

     

    This is for if the field you are looking at is a Choice Field as the column type. I just did a test on my side to make sure and this will pull up showing nothing in the gallery and once they select an option from the combo box that is all the gallery shows is the items that match that criteria. 

     

    Let me know if I missed anything or there is something else not working right on this. Sorry I got confused on your need. 

  • tjtaylor Profile Picture
    55 on 21 Jan 2020 at 18:25:09
    Re: Reset gallery when entering screen

    I think I've mis-communicated. I want the gallery to show no items until something is selected from the dropdrown or combo box. When users navigate to this screen, I want it blank. 

  • rebeccas Profile Picture
    2,591 on 21 Jan 2020 at 17:51:09
    Re: Reset gallery when entering screen

    If you want it to show everything when nothing is selected in the combo box you would still need to do the if statement to allow it to not have a filter and for the filter part it would be ComboBox3.Selected.Value and the if statement part would be If(IsBlank(ComboBox3.Selected.Value), 'no filter', 'filter')

     

    The reason the combo box works better than the drop down (in my opinion of course) is they can clear it out and select nothing but also because it has searching ability. 

     

    It will work with either the combo box or the drop down though you just have to use the if statement or the gallery will not show anything until something is selected from the box (whichever you use). 

  • tjtaylor Profile Picture
    55 on 21 Jan 2020 at 17:39:49
    Re: Reset gallery when entering screen

    So then my gallery would filter on the combo box like this?

     

    Sort(Filter(DataSource, CurrentStatus=ComboBox3.Selected), Organization, Ascending
    )
  • rebeccas Profile Picture
    2,591 on 21 Jan 2020 at 17:31:48
    Re: Reset gallery when entering screen

    It would be Items=Choices(DataSource.FieldName) and turn off the "Allow Multiples" if it defaults to on because then it will interfere with the filtering abilities. 

  • tjtaylor Profile Picture
    55 on 21 Jan 2020 at 17:18:11
    Re: Reset gallery when entering screen

    My CurrentStatus in my datasource is a Choice field. How would I do a combo box for that?

  • rebeccas Profile Picture
    2,591 on 21 Jan 2020 at 15:49:59
    Re: Reset gallery when entering screen

    Using a hyphen is one way around it not allowing for a blank. If you are using that option then instead you need to do:

     

    If(dd_CurrentStatus_1.Selected.Value="-",
    Sort(DataSource, Organization, Ascending),

    Sort(Filter(DataSource, CurrentStatus.Value=dd_CurrentStatus_1.Selected.Value),Organization, Ascending)

    )

    --- This is saying if the hyphen is selected don't filter, otherwise do. Same thing, just a variation on it. Make sure you get space or no space correct on that part in the quotes...it needs to match exact.

  • tjtaylor Profile Picture
    55 on 21 Jan 2020 at 15:45:30
    Re: Reset gallery when entering screen

    It's still not working. Is it because I have a hypen (-) in the dropdown menu and a hyphen (-) as an organization name? I have other screens that reset the value to blank, just not on my reports screens.  

     

    Here's where users navigate from:

    InkedReportScreen_LI.jpg

     

    Here's the screen that continues to show the gallery list even though nothing is selected in the dropdown:

    CurrentStatusScreen.PNG

  • rebeccas Profile Picture
    2,591 on 21 Jan 2020 at 15:21:12
    Re: Reset gallery when entering screen

    A dropdown doesn't work well if you want them to be able to choose nothing. It won't really stay with a blank value and if they click on something it will never let them put it back to nothing again. Combo boxes work better for this. 

     

    That being said I think your issue might be more on what you have for the items of you gallery, you need to put an if statement in there or something that says to show everything if they haven't selected anything yet...change that to:

     

    If(dd_CurrentStatus_1.Selected.Value="",
    Sort(DataSource, Organization, Ascending),

    Sort(Filter(DataSource, CurrentStatus.Value=dd_CurrentStatus_1.Selected.Value),Organization, Ascending)

    )

     

    This will tell it that if the drop down doesn't have anything selected yet show everything...otherwise do the filtering of it.

  • tjtaylor Profile Picture
    55 on 21 Jan 2020 at 15:15:31
    Re: Reset gallery when entering screen

    Thanks! I had update context but it wasn't working.

     

    I tried the variable suggested but the gallery is still showing results even though the dropdown is "". Here's what I have for my gallery that displays the results of the current status dropdown:

     

    Sort(Filter(DataSource, CurrentStatus.Value = dd_CurrentStatus_1.Selected.Value), Organization, Ascending
    )
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete