# Split with js formula

**URL:** <https://community.glideapps.com/t/split-with-js-formula/71622>\
**Category:** Ask for Help\
**Created:** [March 12, 2024, 2:02pm UTC](https://community.glideapps.com/t/split-with-js-formula/71622 "2024-03-12T14:02:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luca\_Dipa](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luca_dipa/32/67530_2.png) [@Luca\_Dipa](https://community.glideapps.com/u/Luca_Dipa)\
**Post date:** [March 12, 2024, 2:02pm UTC](https://community.glideapps.com/t/split-with-js-formula/71622/1 "2024-03-12T14:02:12Z")

</div>

Hi guys,

i have a problem with splitting text in js column. Why it doesn’t split the string? Where is the error in the formula?

P.S: I don’t use the split column because i have to add `<li>` tag to create a list.

Thanks for your help!  
 ![Screenshot 2024-03-12 145841](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/b/9b77c071985af234aadaa606d7f1a35ac04880f9.png)

 ![Screenshot 2024-03-12 145805](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/8/8888a490410dbc65f8dc03612ab50079372b5ccd.jpeg)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [March 12, 2024, 2:09pm UTC](https://community.glideapps.com/t/split-with-js-formula/71622/2 "2024-03-12T14:09:51Z")

</div>

Because the JavaScript column can not return an array.

What do you mean by adding a `<li>` tag? Do you mean you split those and add that tag to each element?

In that case, here’s what you need.

```auto
return p1.split(",").map(function(el) {
    return "<li>" + el + "</li>";
  }).join("");

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/c/0c01c91b6f3bd11dae427ef6705239544d293d70.png)

---

<div class="post-metadata">

**Author:** ![Luca\_Dipa](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/luca_dipa/32/67530_2.png) [@Luca\_Dipa](https://community.glideapps.com/u/Luca_Dipa)\
**Post date:** [March 12, 2024, 2:57pm UTC](https://community.glideapps.com/t/split-with-js-formula/71622/3 "2024-03-12T14:57:53Z")

</div>

Yes! What I wanted 😍

---

<div class="post-metadata">

**Author:** ![NFNHello](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nfnhello/32/3371_2.png) [@NFNHello](https://community.glideapps.com/u/NFNHello)\
**Post date:** [March 12, 2024, 3:09pm UTC](https://community.glideapps.com/t/split-with-js-formula/71622/4 "2024-03-12T15:09:42Z")

</div>

Bookmarking this for later!

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [March 12, 2024, 3:09pm UTC](https://community.glideapps.com/t/split-with-js-formula/71622/5 "2024-03-12T15:09:46Z")

</div>

Glad it helped!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [March 19, 2024, 3:10pm UTC](https://community.glideapps.com/t/split-with-js-formula/71622/6 "2024-03-19T15:10:17Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
