Search filter (number of bedrooms) issue

Hi all,

I’m building a search feature on a property marketplace. One of the filters is number of bedrooms, there are 2 dropdowns, one for Minimum and one for Maximum, e.g.:

Minimum number: Studio
Max number: 2 bedrooms.

When a user creates a listing, they select number of bedrooms from a dropdown list.

The issue I’m having is that when I try to add the filter, instead of saying #bedrooms = dropdownbedroom’s value (like I might do for # of guests, if I just had 1 guest dropdown), I can’t because there are 2 dropdowns and it seems to not like this.

Here’s how I’m adding the dropdown content:

If anyone could shed some light, that would be great. Thanks :slight_smile:

You could use these two constraints:

of bedrooms > MinBedroom Dropdown - 1

of bedrooms < MaxBedroom Dropdown + 1

Have to use the plus and minus one because it does not let you use the greater than and equal to option

You should also be able to use the <-range-> function to do the same thing, but I haven’t used yet to comment on

Thanks @gf_wolfer!

Does this mean that if a user selects 2 for the the MinBedroom dropdown, it’ll show properties from 1 bedroom, and if the user selects 3 bedrooms as their MaxBedroom dropdown, it’ll show properties up to 4 bedrooms?

Can’t seem to add in the - 1 or + 1 to the end - no option for this unfortunately. Any ideas? I feel like there’s an easy fix in sight but I can’t seem to find it!

You can do the -1 / +1 as a filter.

The way I would do it (and it will help you with your dropdowns too) is to define a new data type with the number 1 to 10.

Then make dropdown 1 dynamic, and search for numbers, sorted low > high.

Then make dropdown 2 dynamic. and search for numbers > dropdown 1, sorted low > high.

Then in your Repeating Group, you can do a … # of bedrooms is in … and bound the number search between dropdown 1 and 2.

No, that was just because the Constraints don’t let you choose a Less than and Equal to.

So if dropdowns were 1min (which is greater than 0) 3max (which is less than 4), it would show options with 1-3 bedrooms

If you cannot access < / > and +1 / -1, maybe the # of bedrooms are being saved as a Number Data Type or Text?
If number it should look like this

@NigelG has a good solution as well. Maybe @mishav’s new toolbox plugin could be used for those numbers instead of a Number Placeholder? Haven’t looked into yet thought so not sure exactly how it works

I still can’t seem to get the - 1 or + 1 values - what should I save # of bedrooms as in the database? I was a text field previously, but I’ve tested number and number range.

I can do: # of bedrooms > MinDropdown’s value, but then can’t add on the - 1 or + 1

Thanks

Edit: Interestingly, when I change ‘MinBedrooms’ to the price slider’s value, I can select - 1 / + 1. Is it because my MinBedrooms and MaxBedrooms are just in standard static dropdowns?

Here’s a link, if that helps: [link removed by author]

I click on the search repeating group to bring up the ‘List of properties’ and then I click on the ‘Search for listings’ data source.

The problem was that you had the word Studio in the Dropdown options. Every option needs to be a number for a calculation like > or < to work.

I switched Studio for a number (0) so you can see.
If you want to leave Studio as an option, then I suggest setting a State on the Dropdown (type Number), and set a Conditional to change the state to the Correct Number every time the Dropdown is changed. Then you can reference the Dropdown’s Number (a state) in the filter. Bit more complicated if you haven’t worked with States much before.

Curious if this was the BnB template? And if so, was this feature not already built in?

1 Like

Aha, yes that was the issue! It’s important that we have ‘Studio’ in the dropbox so I’ll have to figure that one out another time.

It’s not the BnB template, but I am following Brett’s CodeFree Airbnb course to learn the ropes and get an MVP up and running!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.