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 / button that opens scre...
Power Apps
Answered

button that opens screen with filtered gallery

(0) ShareShare
ReportReport
Posted on by 13

Hi all

 

I am quite new with powerapps and like some advice. I have coded a button on the 'homescreen'. I'd like this button to open another screen 'BrowseScreen1' and on that screen to filter in a gallery (set as 'items - recordscollection') based on the text in the button from the homescreen. the sourcedata is an xl file on onedrive 'thedata'

 

Navigate (BrowseScreen1,Fade)||Filter(thedata,'Business Unit'= 'Buttonpharma&agro'.Text.value)

 

the filter formula works when I put it simply on the gallery item, but I can't get them to work together... I think that in the above formula the gallery name is missing where to filter it in, but I could be wrong... any ideas?

 

oh yes... I also coded a search label for the browseScreen1 (to complicate a bit) to search in this filtered gallery...

the simple Search function works - Search(thedata,SearchBox.Text,"product_name") - but is it possible to do this search only after the filter of the button has works... in the same gallery that is... 

Categories:
  • Verified answer
    mdevaney Profile Picture
    29,993 Moderator on at

    @CedricC_1 

    Put this code in the OnSelect property of each button on your main page.  Change BusinessUnit1 to match your Business Unit.

    Set(currentBusinessUnit, "BusinessUnit1");
    Navigate(BrowseScreen1, Fade);

     

    Then use this code in the Items property of the gallery

    Filter(thedata,'Business Unit'= currentBusinessUnit)

     

    Finally, you can add the SEARCH functionality to the code above like this.

    Search(Filter(thedata,'Business Unit'= currentBusinessUnit),SearchBox.Text,"product_name")

     

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

     

  • CedricC_1 Profile Picture
    13 on at

    great! thanks for the quick reply, works perfect

  • eka24 Profile Picture
    20,925 on at

    Can you show a screenshot of the Button. Will the Text on the button be changing?

    If it is The Text in a TextBox1 then do the following:
    1. Set(MyText,TextBox1) --- OnVisible of the Screen where the Textbox1 is located

    2. On the Naivigation button:
       Navigate (BrowseScreen1,Fade)

     On the Item of the Gallery put:
         Filter(thedata,'Business Unit'=MyText )

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

     

     

  • CedricC_1 Profile Picture
    13 on at

    I am affraid I was a bit too fast.... I receive no fault messages... but when clicking on the button, it opens the second screen but the gallery stays empty ... which is strange as I can change the layout and it doesn' t seem to be wrong... anything I am looking over?

  • mdevaney Profile Picture
    29,993 Moderator on at

    @CedricC_1 
    First, try this code on its own.  Let me know if it works.

    Filter(thedata,'Business Unit'= currentBusinessUnit)

     

    Then try it with SEARCH just like I provided in my previous post.  I assume you haven't typed anything into the search box yet, correct?  Please try doing that.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • CedricC_1 Profile Picture
    13 on at

    Hi again

     

    correct, I haven't put in the search box yet. 

     

    the thing is that the code on it's own isn't giving an error message, it's simply not showing the list of filtered items… the gallery stays empty. is there another way to see if the code is working? because In all logic it should be working… 

     

    my apologies for these rookie questions

  • mdevaney Profile Picture
    29,993 Moderator on at

    @CedricC_1 

    Please try my suggestions above and then let me know what the result was.

  • CedricC_1 Profile Picture
    13 on at

    hey

    Filter(thedata,'Business Unit'= currentBusinessUnit)

    unfortunately doesn't work on it's own either...should though... reading through tutorials for hours, but can't find out the reason the gallery is not returning the fields...

  • mdevaney Profile Picture
    29,993 Moderator on at

    @CedricC_1 

    What type of column is Business Unit in SharePoint?  Are you getting any errors or warnings?

  • CedricC_1 Profile Picture
    13 on at

    the type of column is 'general' - also tried it as simple text - and only contain 4 values over around 600 lines.

    no errors or warnings... 

     

    tried it now with a dropdown list and code 

    Filter(thedata,'Business Unit'= Selection.SelectedText.Value)

    and that works... really puzzled. and I'd like the button to work 🙂

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard