# From a Basic Number input make an array

**URL:** https://community.glideapps.com/t/from-a-basic-number-input-make-an-array/68355
**Category:** Ask for Help
**Created:** [December 4, 2023, 8:04pm UTC](https://community.glideapps.com/t/from-a-basic-number-input-make-an-array/68355 "2023-12-04T20:04:47Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Nathan\_Stephens](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathan_stephens/32/63262_2.png) [@Nathan\_Stephens](https://community.glideapps.com/u/Nathan_Stephens)
#### Post date: [December 4, 2023, 8:04pm UTC](https://community.glideapps.com/t/from-a-basic-number-input-make-an-array/68355/1 "2023-12-04T20:04:47Z")

</div>

Hello

I’m trying to figure out if this is possible at all.

I have a number field that is entered somewhere 1 to 50.

I’m trying to figure out how to make an array or even a text field that behaves like the examples below.

Eg. Number: 3

Output 1,2,3

Eg. Number: 10

Output: 1,2,3,4,5,6,7,8,9,10

Is something like this possible?

Thank you for your time.

---

<div class="post-metadata">

### Author: ![AdamMartin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/adammartin/32/66650_2.png) [@AdamMartin](https://community.glideapps.com/u/AdamMartin)
#### Post date: [December 4, 2023, 8:17pm UTC](https://community.glideapps.com/t/from-a-basic-number-input-make-an-array/68355/2 "2023-12-04T20:17:11Z")

</div>

The way I would do this…

1. Create a column that has all the possible numbers… ie:

```auto
1,2,3,4,5,6,7...

```

1. Create column for user input (number).
2. Create a math column that is `user input * 2` - called padding
3. Finally, create a column that will truncate the possible numbers like so:

 ![Screen Shot 2023-12-05 at 9.16.38 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/a/da30bce1ab98fb04607a669d8b3040bb217d89a4.png)

In the ending… put a space

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [December 4, 2023, 8:21pm UTC](https://community.glideapps.com/t/from-a-basic-number-input-make-an-array/68355/3 "2023-12-04T20:21:48Z")

</div>

I would use a bit of javascript in a javascript column that will take the input and return a comma delimited list of numbers. The p1 parameter would be your input number column.

```auto
function generateSequence(inputNumber) {
  if (typeof inputNumber !== 'number' || inputNumber <= 0) {
    return 0;
  }

  const sequenceArray = Array.from({ length: inputNumber }, (_, index) => index + 1);
  const commaSeparatedSequence = sequenceArray.join(', ');

  return commaSeparatedSequence;
}

return generateSequence(p1);

```

If you ultimately want an array, then you can also create a Spit Text column that will convert the result from the javascript column into a true array.

---

<div class="post-metadata">

### Author: ![AdamMartin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/adammartin/32/66650_2.png) [@AdamMartin](https://community.glideapps.com/u/AdamMartin)
#### Post date: [December 4, 2023, 8:24pm UTC](https://community.glideapps.com/t/from-a-basic-number-input-make-an-array/68355/4 "2023-12-04T20:24:49Z")

</div>

Two solutions for you 🙂

---

<div class="post-metadata">

### Author: ![Nathan\_Stephens](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathan_stephens/32/63262_2.png) [@Nathan\_Stephens](https://community.glideapps.com/u/Nathan_Stephens)
#### Post date: [December 4, 2023, 8:34pm UTC](https://community.glideapps.com/t/from-a-basic-number-input-make-an-array/68355/5 "2023-12-04T20:34:32Z")

</div>

Thank you guys

My original idea was to a giant If Then Else Column but that wouldn’t be very dynamic and a simple mistake could be missed.

I appreciate the help.
