# Build a comma separated list

**URL:** <https://community.glideapps.com/t/build-a-comma-separated-list/61463>\
**Category:** Ask for Help\
**Created:** [May 7, 2023, 11:48pm UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463 "2023-05-07T23:48:47Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [May 7, 2023, 11:48pm UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/1 "2023-05-07T23:48:47Z")

</div>

I’m trying to figure out a way to build a comma separated list of values using an action that allows the user to click a button to add or subtract a value from the list. Once I have that list, I would use a relation to display the items on their list.

From a user interface standpoint, they would see a list of items in the list component, and when clicking on any one of them, it would toggle between adding it to the list, or subtracting it from the list. The list would be in a different table and would be a comma separated list made up of a unique value for each item. So column one would be the name they assigned the list they are making, and column two would be the comma separated list of values.

This is mostly functionally the same as the choice component. However, in this case the choice component isn’t a great option, I don’t think. To use it in a list like I’m describing you need to have a second screen that opens that can display the choice component.

Or, i considered displaying the choice component tiles or radio buttons as “the list” but it is too clunky for the number of items and information I want displayed in the list.

One other approach I considered was that clicking the item in a list would set a checkbox to true, and then using a relation (or now a query, possibly) and a join list to build the comma separated list in a temporary table and then use an action to set the column values in second table with that list. But the problem there is there is no way (no easy way?) to clear all of the check marks in the main table once the user has built the list. (If there is a way to do that, that would be great to hear).

Any ideas how to do what I described above?

---

<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:** [May 8, 2023, 12:19am UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/2 "2023-05-08T00:19:09Z")

</div>

Sounds like a perfect use case for “Data Structure” action, though I have never used it.

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [May 8, 2023, 12:24am UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/3 "2023-05-08T00:24:37Z")

</div>

Create a JSON list… then you can do whatever you want with it.

> [@arrows\_counterclockwise Bulk clear, edit, restore and delete columns plus Undo action](https://community.glideapps.com/t/bulk-clear-edit-restore-and-delete-columns-plus-undo-action/59546):
>
> A little fun with Glide columns, using Java wink It works well and fast. You can edit or clear the whole column in one click… then undo, edit, or restore all to default. I used a regular inline list. You can still edit, add or delete individual rows as usual. It is a free app with no scripts and no Google Sheets… Pure Glide Page (App)

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [May 8, 2023, 12:33am UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/4 "2023-05-08T00:33:07Z")

</div>

Oh yes. I had forgotten about that. I’ll need to experiment.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [May 8, 2023, 12:33am UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/5 "2023-05-08T00:33:27Z")

</div>

Oh wow. Ok. Let me explore this as well.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [May 8, 2023, 1:24am UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/6 "2023-05-08T01:24:10Z")

</div>

> [@dizzy The Trebuchet Method](https://community.glideapps.com/t/the-trebuchet-method/48325):
>
> In certain situations, a single column has the potential to replace an entire table of data. The Trebuchet Method allows you to create an inline array that allows you to create a SIMPLE one-to-many relationship between two sets of data without the need of a log or submissions table. Examples: Who owns which item Who has registered for an event Who has completed which task Pros: no app bloat no additional rows of data fairly easy to set up Cons: Can only track one data point (eg. who has w…

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [May 8, 2023, 1:28am UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/7 "2023-05-08T01:28:58Z")

</div>

Yes. I have the same relationship with the The Trebuchet Method as I have with String Theory. 🤣 I was also hoping that new tools in Glide might provide a more streamlined approach. But I will review again. Thanks for the reminder.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [May 8, 2023, 1:58am UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/8 "2023-05-08T01:58:41Z")

</div>

If you find Trebuchet intimidating, then Thinh’s suggestion (Data Structures) may be worth looking into. It essentially does the same thing as Trebuchet, without all the mental gymnastics.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [May 9, 2023, 4:56am UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/9 "2023-05-09T04:56:23Z")

</div>

Ok. I have to admit I’m lost on how to implement Data Structure. I assume I want to create a column using “Array to Set” that looks to the column of comma separated values. Using the Array to Set Column, I chose a column made up of comma separated values as the data element. It returns data formatted like this:

[“A, B, C”],

when what I think it needs to be is [“A”, “B”, “C”].

Attempting various ways of enclosing each item in “” results in the “” being escaped [“A, "B", "C"”]. Choosing a column that is an array column produces an empty set.

Any guidance or examples would be helpful.

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [May 9, 2023, 5:06am UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/10 "2023-05-09T05:06:23Z")

</div>

Use the Join column, then the Template column to create an array… or JavaScript.

 ![Screen Shot 2023-05-09 at 1.10.49 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/5/45ad903a3aed874947c9f662632d8e4fdb04b5fa.jpeg)

 ![Screenshot_20230509-014124_Samsung Internet](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/0/80be7ed2adb524e3fae82f2c0be61e1ef0cb8934.jpeg)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [May 9, 2023, 5:22am UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/11 "2023-05-09T05:22:45Z")

</div>

> [@BLA\_68](#):
>
> Ok. I have to admit I’m lost on how to implement Data Structure. I assume I want to create a column using “Array to Set” that looks to the column of comma separated values. Using the Array to Set Column, I chose a column made up of comma separated values as the data element. It returns data formatted like this:
> 
> [“A, B, C”],
> 
> when what I think it needs to be is [“A”, “B”, “C”].

hehe… both @kyleheney and myself tried to figure this out, and neither of us could. In the end we concluded that (at least) the Array to Set option is buggy. David seemed to confirm this, and so now we’re waiting to see if/when it will be fixed.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [May 9, 2023, 5:29am UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/12 "2023-05-09T05:29:16Z")

</div>

Thanks. I was able to make a set using a template as @Uzo suggests, but that does seem like a step that “Array to Set” should be doing. Also, now that I’ve played with it, and rewatched Bob’s video, maybe it’s not that much simpler than the Trebuchet method (and Trebuchet isn’t that daunting, I suppose…)

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [May 9, 2023, 5:32am UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/13 "2023-05-09T05:32:07Z")

</div>

If you are not too far with your App… I would suggest switching to JSON files… 😉

---

<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:** [May 20, 2023, 7:37pm UTC](https://community.glideapps.com/t/build-a-comma-separated-list/61463/14 "2023-05-20T19:37:17Z")

</div>

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