API and multiple tables

Hi,

I am wondering how people would go about this kind of scenario:

  • I have several tables in baserow
  • Each of those table contains references to each other using the Link to table feature in hierarchies (like Table A containing towns, Table B containing adresses Link to table towns, Table C containing people Link to table B)
  • I want to use the API to be able to get for example “give me the town that person x lives in based on the persons email”

Do I really need to multiple API requests for this? E.g. first use the API of Table C to get the person x based on email, then based on the information on the linked table b that is returned I need to do a API call to either Table A or B to check the town? Any smart work arounds?

Kind regards,
F

Hello @flipzz, apologies for not getting back to you earlier :pray:

@Alex, @frederikdc, or @petrs, maybe anyone of you guys has a good suggestion/workaround for this?

Hi,

This can be solved with lookup fields. This type of field allows you to link multiple columns of a certain table. For example:
Table A contains info about cities

Table B about addresses

This table has a link with cities, but I also added a Lookup field so that the ZIP code is also shown in the table and will be available through the API

Table C contains information about persons

I have a link with an address an use 2 lookup fields. One for the city and one for the ZIP code. The reason that I can also refer to the ZIP code is because it is already a Lookup field in Table B.

Hope this solves your problem.

Regards
Frederik

Hi,

but this only works for “one level” relationships right? Not Table A-[Lookup]-[Table B]-[Lookup]-[Table C] (if you understand how I mean).

I see.

You can solve this by adding a formula field to the table(s). The formula uses the function row_id() and will contain the unique id of the row.

You can now add this formula fields as a lookup field to other tables.

Hope this solves your problem.

Regards
Frederik