Lookup table with multiple selections but able to select one value more than once, is it possible?

Hello! I am creating a coda document to analyze data from football matches. I have a table of players and I have a table of matches. For every match I need a column with the players who score in that match. I am using a lookup column allowing multiple selections but the problem is that I need to be able to select one player more than once depending on the number of goals he scores. Is this possible using coda?

coda

Imagine in the column “Goleadores” in the row one I want the player Luci to appears 3 times as he scores 3 goals

Thanks

Hello @Lucidio_Vacas!
It is possible, but you need a third table with the goals and then make a lookup form that table in your matches table.
I leave a coda showing this:

5 Likes

Hi @Saul_Garcia
Thanks for the answer. Yes, it could work, but my idea was to introduce the data in the same table, quick and easy. We add this data after we play the match and I was looking for a simple way to do it, that doesn´t require to fill different tables.

I imagine this solution you showed me is the only one. So thanks anyway

Oh don’t worry, you can use buttons to fill it from one table.
Check the coda again to check how I did it!

@Saul_Garcia Thanks man! :smiling_face_with_three_hearts: That´s a great idea! Thanks you for the answer and the effort!

The only inconvenient is that I create a lots of rows compare to what I wanted but I thinks it’s the only way :slight_smile:

1 Like

I was playing around with this and wanted to see if there was a way to keep adding to a list without adding rows. Here’s another option that may work for you using the Splice() formula in the button.

5 Likes

Hi @BenLee, just amazing :clap: what ideas are brought forward to approach realistic use-cases

Tomorrow I will play around to understand better how …

There are advantages to both cases, and I’d generally lean towards @Saul_Garcia’s solution because adding features can be easier. This is a fun one though and has some benefits of being a little shorter. All depends on the use-case and what you need from it.

2 Likes

Wow! I didn’t think you could do that! So, the trick here is not to turn the allow multiple selections toggle on, right? as soon as you do it all the duplicates disappear :thinking:
Thanks @BenLee!

That’s right…and I’m not sure why.

This is a formula we use for our Voting tables in the “In Doc Templates”. If you check out the button formula, this is how it writes and removes a person’s vote from one of the columns.

1 Like

I reported this issue a while ago through Intercom, and I think it got lost.

When “allow multiple selections” is enabled, the list is displayed as unique values. However if you use that in formulas, you’ll get all the duplicated elements just right (the true list that’s saved in a cell). I believe this is a display bug and should be addressed (users should see duplicated items if there are actually duplicated items in a cell). I understand that duplicate selections shouldn’t normally be possible with input columns (however nothing really prevents populating an input cell with duplicated references with a formula). But this bug also affects formula columns, and in my case it was a legitimate use.

TL;DR: the duplicates don’t disappear per se — they are simply hidden from display, but the cell still stores them.

CC @BenLee

1 Like

It’s added to the tracker.

1 Like

I would love for this feature to exist natively. I want to have a function that runs for each item, and sometimes I want that function to run multiple times. I use a lookup to select the functions I want to run, but since I cannot select the same function more than once, I need to create a pretty hacky way to choose when a function should run more than once.

This would simplify that greatly.

To give a more specific example, whenever we build a new item, I want to subtract the items that make up that item from our inventory. An easy way to do this is to allow people to use the lookup to select all items that will be removed when a new item is made, but since they cannot select the same item twice, this does not work for building things that contain multiple of the same item.

Your solution above works great though Ben. Thanks. Using a second field to add items with a button is much less complex than what I was doing.

Welp… Nevermind, does not work.

This seems to be due to me referencing the original inventory value which does not change until after the map is done?

This is going outside the scope of this post, so I will end this here.