# Use comma-separated values as source for Choice?

**URL:** <https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724>\
**Category:** Ask for Help\
**Tags:** choice\
**Created:** [February 11, 2024, 6:47pm UTC](https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724 "2024-02-11T18:47:29Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkirkwood001](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jkirkwood001/32/54952_2.png) [@jkirkwood001](https://community.glideapps.com/u/jkirkwood001)\
**Post date:** [February 11, 2024, 6:47pm UTC](https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724/1 "2024-02-11T18:47:29Z")

</div>

_(Couldn’t find this asked elsewhere)_

I am adding a voting component to my app. I have a page to create a vote ‘motion’. I have a default vote choices of “In Favour” / “Against” / “Abstain”. but the admin can also create a set of choices, like “Red” / “Green” / “None” with no theoretical limit on # of choices.

I thought of having 5 columns for up to 5 vote choices, but that seemed clumsy and didn’t resolve my problem anyway (see below). I have a toggle to use the standard vote options:

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

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/3/13bf226c79b9ac32c5218c68a8f3f0badc5a95d5.png)

My problem is, **how do I use that comma-separated list as the source for my Vote buttons?**

I can’t seem to use either a plain comma-separated text field as all the values appear as one button. Nor can I select an array to use as the source. The Choice component only seems to want table rows from a single column:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/6/e6fc4cc566e3f6ddd34db8546db68fbae164feb4.png)

I guess I could do some gymnastics to create unique Action buttons for each option, but that also seems kludgey.

_Any suggestions?_

Thanks!

---

<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:** [February 11, 2024, 7:02pm UTC](https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724/2 "2024-02-11T19:02:48Z")

</div>

You need to use the miracle method to transpose the list.

> [@fishbaguette\_breadbasket Transpose Columns to an Inline List: The Miracle Method](https://community.glideapps.com/t/transpose-columns-to-an-inline-list-the-miracle-method/32766):
>
> I’m often asked how to take columns of data (say form responses) and display them in an inline list. Here’s one way to do it—the MIRACLE METHOD. [[Glide: Transpose Data Columns into an Inline List with the MIRACLE METHOD] ](https://www.youtube.com/watch?v=t-sh_Q3WbQc)

---

<div class="post-metadata">

**Author:** ![jkirkwood001](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jkirkwood001/32/54952_2.png) [@jkirkwood001](https://community.glideapps.com/u/jkirkwood001)\
**Post date:** [February 11, 2024, 7:11pm UTC](https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724/3 "2024-02-11T19:11:43Z")

</div>

Thanks, Darren.

Hmm, the video’s interesting but I’m not sure how to apply in my case. I don’t have the list of items in rows anywhere. They’re only ever in one text field. I’d rather not make a column somewhere to track the list of options for every poll / motion we want to vote on, right?

The goal is to have a set of Choice options from that single text input. Here’s how it _shouldn’t_ look:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/d/8d8a4a09fe41d1de579e2be3b9455adbcac09376.png)

Please confirm.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [February 11, 2024, 7:27pm UTC](https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724/4 "2024-02-11T19:27:44Z")

</div>

The miracle method allows you to transpose a CSV to rows using a helper table. I think I’ll recreate this video to showcase the method in a more straightforward manner.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [February 11, 2024, 8:24pm UTC](https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724/5 "2024-02-11T20:24:40Z")

</div>

Here’s a rough draft of the video I plan on reshooting this week:

---

<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:** [February 12, 2024, 2:53am UTC](https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724/6 "2024-02-12T02:53:19Z")

</div>

> [@jkirkwood001](#):
>
> I don’t have the list of items in rows anywhere.

The idea is to dynamically generate the list by first creating an array from the list, then using a Helper Table with a row index, and finally a Single Value column to select each item from the array on a separate row. Bob’s original video maybe doesn’t explain this as clearly as it could - it was made a long time ago.

> [@jkirkwood001](#):
>
> I’d rather not make a column somewhere to track the list of options for every poll / motion we want to vote on, right?

You don’t have to. It can all be dynamic.

---

<div class="post-metadata">

**Author:** ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)\
**Post date:** [February 12, 2024, 9:51am UTC](https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724/7 "2024-02-12T09:51:04Z")

</div>

I had this problem for one of my apps - and the simplest way to fix:

- you have the options that people are saving in a column, let;'s call it usc-mychoice

- you have some lookup table to display your choices - some of which might have commas

- you then have a choice component where the user can select multiple options, with the value going into usc-mychoice

- for the users choice, I have a column that displays the items as written (e.g. "Projects, initiatives, programs’) and NEXT I have a ‘Replace All’ column that replaces , with /

- for the user choice, I display the original item, but I store the values wuth the Replace All column values - which does not contain the comma 🙂  
Hope this helps!

---

<div class="post-metadata">

**Author:** ![jkirkwood001](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jkirkwood001/32/54952_2.png) [@jkirkwood001](https://community.glideapps.com/u/jkirkwood001)\
**Post date:** [February 12, 2024, 4:24pm UTC](https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724/8 "2024-02-12T16:24:30Z")

</div>

Thanks Mark. That could work, except my Choice list is going to vary and the number of polls / votes will grow over time. So I don’t think a fixed column per poll is scalable.

I’m groing to try and use Rob’s updated video - thanks @Robert_Petitto! And thanks @Darren_Murphy for always helping too.  
🙂

---

<div class="post-metadata">

**Author:** ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)\
**Post date:** [February 12, 2024, 8:30pm UTC](https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724/9 "2024-02-12T20:30:17Z")

</div>

I have the same problem as you… likely unlimited potential number of pills, etc.

So I use the user table a lot to set values, such as an id to find the row (eg ‘survey id’). Then in the user table I do lookups to find question id things for the questions that might be included.

…. Then I have my helper table that pulls in the user values to get the question or survey ids. Then I pull in the single cell that contains my options s (could be a make array column, template, etc)…

Then the helper table has the first column with index numbers, starting at 0. And I do a single value, taking that single cell with the options, and split into rows using the index number.

And then I have my ‘remove elements’ to solve the comma issue. And I have my layout choice component using the helper table as a source, and storing the non-comma response 🙂)

Tada!

---

<div class="post-metadata">

**Author:** ![jkirkwood001](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jkirkwood001/32/54952_2.png) [@jkirkwood001](https://community.glideapps.com/u/jkirkwood001)\
**Post date:** [February 15, 2024, 11:06pm UTC](https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724/10 "2024-02-15T23:06:22Z")

</div>

It works! Thanks folks 🙂

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

---

<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:** [February 22, 2024, 11:07pm UTC](https://community.glideapps.com/t/use-comma-separated-values-as-source-for-choice/70724/11 "2024-02-22T23:07:16Z")

</div>

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