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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Creating a Filter Butt...
Power Apps
Answered

Creating a Filter Button and Linking to that Filtered List from another Screen

(0) ShareShare
ReportReport
Posted on by 103

Having too many issues with multiple galleries synching up with a single Detail and Edit Screen so I am thinking of going another route and creating a Filter Button in my Full Gallery list that only shows a filtered view.  I also want to be able to link to that filtered view or the full view from another screen with a clickable icon.

 

Current Setup

 

BrowseGallery1 has all items.   

 

SortByColumns(Filter([@'Coverage'], StartsWith(Title, TextSearchBox1.Text) Or StartsWith('Assigned Rep',TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

My current BrowseGallery2 was set up to show only those records where a rep has not been assigned (ie that column is blank):

 

SortByColumns(Filter([@'Coverage'], 'Assigned Rep'=Blank()), "Title", If(SortDescending1, Descending, Ascending))

 

Issue:

I created a button in Gallery 1 but not sure how to code it correctly to change the look of Gallery1 to only show the unassigned records (and still be able to search by Title and Assigned Rep).    Also then having trouble figuring out how to then create two buttons on my home screen (one for all records and one for unassigned records) that goes to the correct Gallery1 view.  

 

Thanks

Categories:
I have the same question (0)
  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi  @barkir ,

    Do you want to create two buttons to control the view of BrowseGellary1?

    I've made a similar test for your reference:

    Step1: add a button control and Set the control’s OnSelect property to:

     UpdateContext({var:false})

         Set the control’s Text property to:

     "all records"

    Step2: add a button control and Set the control’s OnSelect property to:

     UpdateContext({var:true})

         Set the control’s Text property to:

     "unassigned records"

     //“var” is my custom global variable which will be used to change the data source of the function “filter”

    Step3: Set the BrowseGallery1’s Item property to:

    SortByColumns(
    
     Filter(
    
     If(
    
     var,
    
     Filter(
    
     [@'Coverage'],
    
     'Assigned Rep' = Blank()
    
     ),
    
     [@'Coverage']
    
     ),
    
     StartsWith(
    
     Title,
    
     TextSearchBox1.Text
    
     ) Or StartsWith(
    
     'Assigned Rep',
    
     TextSearchBox1.Text
    
     )
    
     ),
    
     "Title",
    
     If(
    
     SortDescending1,
    
     Descending,
    
     Ascending
    
     )
    
    )

         When the "unassigned records" button is triggered, BrowseGallery1 only shows the unassigned records (and still be able to search by Title and Assigned Rep)

         When the "all records" button is triggered, BrowseGallery1 shows all of the records(and still be able to search by Title and Assigned Rep)     

    347.png

     

          

     
     

    If you still have any question please don’t hesitate to let us know

       

       

    Best Regards,

  • barkir Profile Picture
    103 on at

    @v-yutliu-msft 

     

    Thanks for responding that part worked great.   Now for the 2nd part of my question.  What do I use as the OnClick code for my Home screen so I can either choose to immediately see all or unassigned items?

     

    For example:   I set my Icon on the Home page to On Select:

     

    Navigate(BrowseScreen1); UpdateContext({var:true})   

     

    and it navigated to the screen but didn't filter it to show only the open requests.

     

    Bonus Question:  For my search in the gallery how would I change your code from starts with to Contains (or Search in)?  Tried to convert to Search instead of filter but I think I was placing things in the wrong space.

     

    Thanks again for responding!

     

     

  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @barkir :
    Q1:

    The reason why you met this problem is that the variable that UpdateContext() function create could only be valid in its created screen, in your issue is Home page.

    It will not be valid in BrowseScreen1.

    To solve these problems, I suggest you two solutions:

    1)use Set() function to create variable

    This kind of variable will be valid in all screens.

    Set the  OnClick code for  Home screen:

    Navigate(BrowseScreen1);Set(var,true)

    2)use navigate to pass variable to next screen

    Navigate function has the feather of passing varible.

    Set the  OnClick code for  Home screen:

    Navigate(BrowseScreen1,None,{var:true}) 

    You could check the doc about Navigate function:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-navigate

     

    Q2:

    If you want to change the condition from startwith to Contains, I suggest you use "in" in your Filter function.

    Also, I suggest you still use filter function, not Search function, because you have other conditions.

    Try this formula:

    SortByColumns(
     Filter(
     If(var,
     Filter([@'Coverage'],'Assigned Rep' = Blank()),
     [@'Coverage']
     ),
     If(IsBlank(TextSearchBox1.Text),
     true, 
     TextSearchBox1.Text in Title||TextSearchBox1.Text in 'Assigned Rep'
     )
     ),
     "Title",
     If(
     SortDescending1,
     Descending,
     Ascending
     )
    )

     

     

     

    Best regards,

  • barkir Profile Picture
    103 on at

    @v-yutliu-msft I used your second suggestion for Navigate and then updated my search.  Might have been a spacing issue but was having trouble with || so instead I put Or and everything works great.

     

    Thanks for all the help!!!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard