Get references from several tables as a choice list

This may already be covered elsewhere, but I’m not sure which keyword should I search for.

I have several “location” tables (let’s call them “Spain”, “Italy”, etc.) with email addresses (each unique). I want to create a new table (“Global”) that list all of these addresses, and a “Location” column that tells me if a given address is in “Spain”, “Italy”, or both. I know how to set the “Email” columns in my location tables as references to the “Email” column in “Global”; that allows me to use a formula such as bool(Spain.lookupRecords(Email_index=$id).Email) to have a column “Spain” that tells me if the address in in “Spain” or not. But that means I have to create a different formula column for each of my location tables.
Is there a way to put all this info in a single column instead, ideally as a choice list?

Thanks in advance!

Before looking at this, I’d have a question: why not have only the Global table with location and email columns, then use a filtering widget to build different views for each location?

1 Like

The thing is, the “location” tables get their data from several external forms (one for each “location”), and the “Global” table is automatically filled with the data from the “location” tables, using an n8n workflow (I can share it to you if you’re curious).

In the meanwhile, I’ve found a workaround using an additional formula column that aggregates the data from the “location” columns in my “Global” table; I still have to create one column per location though.

l = []

if $Spain:
  l.append("From Spain")
  
if $Italy:
  l.append("From Italy")
  
if $France:
  l.append("From France")
  
return l

Sure, if you can share, it’s always easier to think about documents we have on sight!

Hey,
Thanks for sharing this!
How do you make that l be in the choice list?
I am still trying to understand how Python and the web connect.
Thanks!
Thanks

Hello, and sorry for the delayed answer,

Here is a sample document illustrating the behavior: Document sans titre - Grist

As for the n8n workflow, it looks more or less like this (I can share an import if you want, but I’ll have to purge it of any sensitive data first):

Basically, each time one of the 3 tables has a new recording, a webhook triggers the copy of these new lines to a consolidated table.

Hope that’s useful!