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 / Filtering using 2 Text...
Power Apps
Answered

Filtering using 2 TextInput boxes

(0) ShareShare
ReportReport
Posted on by

Looking for something quite simple but it seems to be escaping me.

I have 2 TextInput boxes and a Gallery.  Each TextInput box is separate to each other with a Search button linked to them.  One box searches phone numbers the 2nd searches postcodes.  
What I need is when a phone number is entered into the 1st box and the search button is pressed, the gallery will filter on that number if it exists in the datasource (Sharepoint list, Title column).
Or if a postcode is entered in the postcode box and that search button is pressed the gallery will filter based on that postcode.

I can get them working separately by using Filter('Datasource', varSite in Title) but unable to combine the 2 filters together so either can be used on the same gallery.  Any ideas?


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

    @Smudgers9 

    Here's how I would suggest combining the two textboxes.  Put this code in the Items property of the gallery.

    Filter(
     your_datasource_name,
     TextInput_PhoneNumber.Text in PhoneNumberColumnName 
     Or TextInput_PostalCode.Text in PostalCodeColumnName
    )

     

    Note: I noticed you are using variables instead of references to the Text Inputs themselves.  You can replace the references where needed.


    ---
    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."

  • Smudgers9 Profile Picture
    on at

    Thanks for this, I'm sure I had tried this previously with no success. 

    However, although this appears to work, I need the gallery to be blank when nothing is entered in either of these boxes, or if the variables are blank.  Normally I would use the below but any idea how I get this to work with both search boxes?  I thought of using the Visible attribute to hide the gallery if nothing is entered into these fields but not sure how to get this to work with 2 separate variables.

     

    If(varNumber = "", Blank(),
    Filter('BT-Sites', varNumber in Title Or varPostcode in Postcode))

     

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 339 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 289

#3
Mohsin Ali Profile Picture

Mohsin Ali 228

Last 30 days Overall leaderboard