Forum Academy Marketplace Showcase Pricing Features

Find a range that contains specified number

Hi all.
I’ve got a test app where user can create number ranges:


So you can define name of a range and it’s boarders (from - to).
Now I want to the user to input some number in a special field to get the name of the range that includes the number.
The logic that I want to implement is: search for a range (Do a search for… Range) with constraints (from >= inputed value and to <= inputed value) and then display it’s name. But I cant’t get the idea how to realise it in my app…

How are you storing the range in the database? Some of the logic would change based on that, but you can use :contains to look in a set of data for a specific string.

Hi, Chris!
For a range I have a Thing with three attributes:

  1. name
  2. from
  3. to

There’s a “Numerical Range” data type that you can use for a field. I have a feeling that that is what you want to use here, but I’m honestly not sure how to set the min/max of the field. I can’t seem to find it in the documentation anywhere either… Let me play around with it a bit and I’ll let you know if I figure it out.

Apparently the Numerical Range field type is only used for the slider selector ( https://forum.bubble.io/t/field-type-numerical-range-and-date-interval/5 )… Still thinking about how to do this.

Yep, Chris. When I found “numerical range” in fields type - I thought that it will solve my issue. But it it doesn’t because I do not want to use slider :frowning:
To search for a range that :contains specified number we need to have something like an array [from,…,to]. But I can’t find a way to create an array in bubble…

I’m very interested in arrays. Haven’t been able to figure that out yet either. I’d like to use it for stock display on the front-end based on a stock value in the DB. E.g. stock value = 10, then array goes from 10-0.