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?
Solved! Go to Solution.
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."
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."
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))
User | Count |
---|---|
120 | |
86 | |
83 | |
74 | |
69 |
User | Count |
---|---|
215 | |
179 | |
140 | |
108 | |
83 |