***updated: switched from Left() to Right() after re-reading your earlier post
OK, I just loaded up the template to take a look, and, well that's pretty interesting. Without digging way deep into how they set up those datasources, I guess we can just shortcut things a bit. Not my favorite thing to do as a developer, but if your room naming convention permits, then we can just string match our way to this.
So, forget what I said about adding a column to your dataset, BUT, you still will need that button/toggle/whatever and the global param. Then, when you add your Filter to the dataset, you will be matching to the Name:
Search(Filter(RoomsLists, Right(Name, Len(roomTypeGlobal)) = roomTypeGlobal), SearchBox1.Text, "Name")
I've inserted it here inside the Search line of the room list gallery. I'll break it down to explain what I am doing:
- Filter() function trims out any results from the collection that do not match the criteria given.
- Right() grabs the last N characters of a string
- Len() gets the length of a string
So, we have a Global called roomTypeGlobal. It is a string, and it is either "Meeting Rooms" (13 characters) or "Hot Desks" (9 characters). We want to only display rooms where they begin with either Meeting Rooms or Hot Desks, depending on which is currently set to the Global param. So, tracking from the inside of the formula out, we:
- Get the length of the global (9 or 13)
- Get the last N characters of the room name (9 or 13)
- Compare the global to the last N characters and throw away any results that don't match
- THEN perform the search that the user types in.
Hopefully this solves your issue! Mark as resolved if it does!