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:
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:
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:
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.
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.
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!
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.
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 )