Build a comma separated list

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?

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

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

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

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

1 Like

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

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.

1 Like

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.

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


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.


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

1 Like

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

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