Is it Possible for a select list to be selected only once?

Hi Community,

Is it Possible for a select list to be selected only once ?

For Example :

I have 2 Tables Governors and States and I am referencing the States table to the Governors table. Since 1 State can only have one Governor i want the select list to not show the governor that have been selected by other state.

Thanks

@M_Hermi hey that’s a good question and it can be accomplished in Coda. There is a way to configure ‘Lookup Settings’ when you set a column to be a lookup type. Click into the column settings, then scroll to Item Settings. Then add a filter, and then a formula.

Now think of it this way - your formula is going to be looking at the display column from the table that you’ve selected as the lookup. So you need to limit the that list to not include any item that has already been selected. So how do you determine which ones have been selected?

In this example, we have the States table where each state can have a govenor selected. We want to get the list of selected govenors, and we can do that by getting the list States.Govenor.

Now to tie this back to the lookup filter, you use the currentvalue variable to tell the filter to check each item, and we want to see if the currentvalue is in() that list. This can be written as CurrentValue.In(States.governor).

OK but you don’t want it to show if its already been selected. We now reverse the logic by adding not() to the formula:

not(CurrentValue.In(States.governor))

I’ve created an example and video to show you. Good luck!


Screen Cast 2020-04-18 at 8.59.29 PM

7 Likes

Hey @Johg_Ananda

Thank you so much for your help !

Very well explained and so useful.

1 Like

“Do not allow duplicates” is such a common data constraint that in many column types it might merit its own toggle option in column type options > item settings. :grinning:

@BenLee

2 Likes

Dear @Johg_Ananda,

Great sample on how to explain, thanks for the inspiration :handshake: :diamond_shape_with_a_dot_inside:

Definitely something also I need to improve!

2 Likes

@Jean_Pierre_Traets what did you like about the explaination - what was inspiring?

1 Like

Hi @Johg_Ananda,

In an non technical way, step by step, explanation of the logic.
Including from where you take, the reason to do so and what to expect.

Personally for me, I am still not familiar enough with:

  1. in()
  2. not()

And have to admit, also for me it was something I couldn’t solve it on my own, even being a “community champion”.

Thanks to this community, step by step I am overcoming these shortcomings

3 Likes