I’m trying to display a number based on how many kilometres it equals. Eg if KM value = 2000 what I want to do is show the text 5 as 2000km falls within that range in my database. See below.
Having a range feels like the ideal way to set up my data because there will be quite a lot of possible ranges, probably 0-100, 101-200 etc. I’m just now stuck trying to filter on it and output the correct number. I have the KM value as a custom state and/or url param at the moment as I’ve been fiddling with getting it working.
I’m pretty new to this and might be doing it in a bad way and perhaps staring at it for hours as mushed my brain. Any help is greatly appreciated.
Hi @TedSmokey and Welcome to this forum
Bubble lets you do this in a simple way using Ranges.
What you have to do first is to set a field to the type numeric range
Then, you can save those values using for example a Slider Input element
And then it's easy to search for the record that matches the value like this
Please make sure you’re using “Contains(point)”.
Hope I made it clear, if not feel free to ask again
Please leave a like and mark as solution if I solved your problem
@joao1997domingues - Thank you so much! That solved my problem. I was so close yesterday, as I had been trying to use the numeric range field but I couldn’t work out how to enter data from the DB Editor. Using the slider I was able to input the data into the numeric range field.
For other users who come to this post in time, here’s some screenshots of what I did following Joao’s instructions to get it work.
- Created a numeric range field type in my custom Data type
- On a new page I inserted a slider input, a text field to show me what those ranges were as I moved the slider, and then a submit button to set up the workflow to submit the data to the correct table and field.
- Here’s the workflow:
- That submits the ranges to my Data type field I set up in step one called KMRange (the values for each range you can see, 2 & 5, I just manually entered after the range was in there)
- Then on the page I want to show the value for that range, I inserted a text box that does a search for the record and uses Contains(point) in the constraints for the search. It gets the K value (which is my Number of KMs) from the URL.
Glad I helped @TedSmokey!!
This topic was automatically closed after 70 days. New replies are no longer allowed.