# Find a range that contains specified number

**URL:** <https://forum.bubble.io/t/find-a-range-that-contains-specified-number/3894>\
**Category:** Need help\
**Created:** [June 23, 2016, 9:45pm UTC](https://forum.bubble.io/t/find-a-range-that-contains-specified-number/3894 "2016-06-23T21:45:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![artemzheg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/artemzheg/32/9651_2.png) [@artemzheg](https://forum.bubble.io/u/artemzheg)\
**Post date:** [June 23, 2016, 9:45pm UTC](https://forum.bubble.io/t/find-a-range-that-contains-specified-number/3894/1 "2016-06-23T21:45:50Z")

</div>

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

> **[Bubble Editor - supertest1](https://bubble.io/page?name=index&id=supertest1&tab=tabs-1)**
>
> Build stuff without code and launch a startup without a tech-cofounder! Bubble is a visual programing language. Instead of typing code, use a visual editor to build applications.

  
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…

---

<div class="post-metadata">

**Author:** ![ChrisL](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/chrisl/32/271_2.png) [@ChrisL](https://forum.bubble.io/u/ChrisL)\
**Post date:** [June 24, 2016, 12:55pm UTC](https://forum.bubble.io/t/find-a-range-that-contains-specified-number/3894/2 "2016-06-24T12:55:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![artemzheg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/artemzheg/32/9651_2.png) [@artemzheg](https://forum.bubble.io/u/artemzheg)\
**Post date:** [June 24, 2016, 1:55pm UTC](https://forum.bubble.io/t/find-a-range-that-contains-specified-number/3894/3 "2016-06-24T13:55:29Z")

</div>

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

1. name
2. from
3. to

---

<div class="post-metadata">

**Author:** ![ChrisL](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/chrisl/32/271_2.png) [@ChrisL](https://forum.bubble.io/u/ChrisL)\
**Post date:** [June 24, 2016, 5:46pm UTC](https://forum.bubble.io/t/find-a-range-that-contains-specified-number/3894/4 "2016-06-24T17:46:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChrisL](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/chrisl/32/271_2.png) [@ChrisL](https://forum.bubble.io/u/ChrisL)\
**Post date:** [June 24, 2016, 5:57pm UTC](https://forum.bubble.io/t/find-a-range-that-contains-specified-number/3894/5 "2016-06-24T17:57:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![artemzheg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/artemzheg/32/9651_2.png) [@artemzheg](https://forum.bubble.io/u/artemzheg)\
**Post date:** [June 24, 2016, 9:11pm UTC](https://forum.bubble.io/t/find-a-range-that-contains-specified-number/3894/6 "2016-06-24T21:11:41Z")

</div>

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 ☹  
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…

---

<div class="post-metadata">

**Author:** ![jonaspalmqvist](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jonaspalmqvist/32/7307_2.png) [@jonaspalmqvist](https://forum.bubble.io/u/jonaspalmqvist)\
**Post date:** [October 6, 2016, 2:14pm UTC](https://forum.bubble.io/t/find-a-range-that-contains-specified-number/3894/7 "2016-10-06T14:14:46Z")

</div>

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.
