i have a multiple input to capture as filter to my display. the input for my filter is in popup form. however, i can only filter the right way if i only put one input. if i put more than 1, it wont filter my display according to the multiple input that i key in to filter. as fir now i am using a condition method to filter but it is not working
Hi @acap Just to double-check, four of those filters are referring to Max Price, Seller, Distance, Date – what are the other two? And the filters you need can only be dropdowns or you might use inputs and range elements as well?
@fayewatson its date and type. the max price and distance is in number format and date is in date format
harga max = max price (number)
orang sebilik = people / room (text because no calculation needed. just display)
penerbangang = airline (text)
jarak maximum - max distance (number)
tarikh = date (date)
jenis umrah = type (text)
You have a separate condition for each and every value of the dropdown. This makes no sense. What you want to do is simply have ONE search expression and move the value of the dropdown to the constraint. Like so:
@keith ive tried doing that. the reason is the dropdown value is a static choice. hence, cant be read as number. and for the last choice in max harga’s dropdown value is above 16,000.
ive created database for those choices so that i can use a dynamic choice. but i cant figure-out the above 16,000 part with this method.
Since the last option contains a text “Above 16,000”, we can use a transparent input which removes that text when filtering the results. In the corner of the popup there is an element called “Input Max Price (Transparent)”:
*The transparent input’s value is “Dropdown Max Price”'s value:find&replace (the find and replace part removes the “Above” text, so the transparent input only contains 16,000 when that option is selected).
Edit: After reading Keith’s post, I realize that this should instead replace"Above 16,000" to empty, since Above 16,000 equals “No Max Price”. This way, the Max Price constraint will be ignored if the User selects “No Max Price”
As @keith stated, you’ll want to select ‘Ignore Empty Constraints’ for the data searches. This is because the User may not fill out all of the filter options. For the options they don’t select a filter for, Bubble will ‘ignore’ that constraint/filter.
You were very close to having that all figured out! You just need to make your database object a little bit fancier… Read on:
There are two things you should do here. First, as you point out, not all of your dropdown choices are numeric. So, instead of having a list of mixed type in your database (which of course you can’t have), you create a custom object, like:
Harga Dropdown Option
A Harga Dropdown Option should have TWO fields on it: The Displayed Caption (data type text) and Value (data type number).
Now you can either make a new data type called Harga Dropdown OptionS (see what I did there?) and give it a field that is of type Harga Dropdown Option (and make that a list), or just “Do a search for… Harga Dropdown Option” and sort them the right way (sort on Value, ascending) to get your dynamic dropdown source.
Now your dropdown selects a thing of Harga Dropdown Option type. What a weird thing to select, right? It’s neither a text nor a number. It’s just a Harga Dropdown Option. BUT, the Harga Dropdown Option’s Caption is a text. And the Harga Dropdown Option’s Value is a number. Cool!
So now…
For the dropdown’s caption field, just use Harga Dropdown Option's Caption. The numeric value associated with that selected object is now the Harga Dropdown Option's Value (and that’s what you’d use in your Search constraint).
Now, the second thing:
[Edit: Removed confusing sentence.] If I’m not mistaken, when “Above 16,000” is selected, that’s the same thing as not having a constraint, right? So you can make THAT Harga Dropdown Option’s Value field nothing (empty, which is the null value in Bubble).
so just to make it clear, i should use constraint on package data source on the repeating group and constraint it base on the values of the dropdown on filter popup instead of using conditional? I’ll give it a try and will update both of u wonderful people!
@acap Right! Instead of listing each possible dropdown value as a conditional statement, you can use the inputs’ values in the constraint, and Bubble will automatically update the results that match the constraints/input values:
For example, if the User selected “JetBlue” as the Airline, and Max Price = 5,000, the constraints would dynamically become “Airline = Dropdown Airline’s value [JetBlue]” and “Price < Input Max Price (Transparent)'s value [5,000]” automatically.
Bubble would show all Packages with the JetBlue airline, below 5,000.
(Though note that I would do the dropdown part differently than Faye did – it’s very clever to pass the text dropdown to another input for conversion, but why do that when you can just construct your dropdown options properly in the first place?
I would argue that my solution is more “Bubble-like” - it takes advantage of the flexible data structures in Bubble, more performant, AND easier to maintain… Note that you can change the dropdown values at any time, either programmatically or manually, without even having to update the app. Simply modifying the Harga Dropdown Values in your database will magically make the dropdown change.)
IT WORKED!!! i’ve spent the whole day yesterday trying to figure this out. thank you so much!!! will let you know if there is any problem in the future if thats alright