Automatically updating a field when adding an entry in a linked table

Hi there,

I tried to solve a problem but after tens of tries, I was about to give up! May be you can help or tell me that it’s not possible :slightly_smiling_face:

Let’s say I have two tables TableA and TableB.
TableA has primary field Name and two other fields City and Role.
TableB has primary field City and two fields Manager and Dev.
I add a new entry in TableA : [Alex, Tokyo, Manager].
Is there a way to automatically report “Alex” in the field Manager of the entry Tokyo in TableB?
In other words, I would like the field “Manager” of each city entry of TableB to be the list of the primary fields of each entry of TableA that have Role value equals to “Manager” and City value equals to “Tokyo”.

I tried to use the filter function combined to lookup but it looks like it can only read fields of one entry.

Thanks for helping :slight_smile:

1 Like

Hi asan,

I created two tables. A table Staff (Table A) and a table Cities (Table B)

The table Staff have 3 fields. The ‘Name’ and ‘Job role’ fields are just single text fields. The field ‘Cities’ is a link to the second table.

The table Cities had originally 3 fields. ‘Name’ and ‘Dev’ are just single text fields. The field ‘Manager’ will need a formula. The field ‘Staff’ was automatically added when I linked the field ‘City’ from the Staff table to the Cities table.

I added the following formula for the field ‘Manager’.
filter(field('Staff'), lookup('Staff','Job role') = 'Manager')

The filter() function takes two arguments. The first one is the field I want to filter. In this case this is the field ‘Staff’. The second argument must result in a boolean value (true or false). So, if the job role of the staff member is equal to Manager, it should be shown, otherwise not.

Hope this solves your problem.



Thank you very much, this helps a lot!

I have two more questions:

  • what if the Job role field is a multiple select?
  • is there a way to end up with the Manager field being a link to the corresponding Staff entry?



Baserow does not allow to use multiple select fields in a formula. In that case, I suggest you create a new table with job roles and link to multiple rows of that table

Yes, but it includes some extra fields. First, I add a formula field to the Staff table that show the id of each row with the function row_id

Next, I create some additional fields in the Cities table:

  • Staff id: is a lookup field that shows the corresponding id’s of the staff members that work in a certain city
  • Manager: shows the id of the staff member that has the role of manager in that city. The formula is filter(field('Staff id'), lookup('Staff','Job role') = 'Manager')
  • Link to staff member: is a formula field that contains a link to the record of the staff member with the following formula: button(concat('',field('Manager')),lookup('Staff','Name')). Please change the id’s of the database, table and views


1 Like

Thank you very much for your precious help @frederikdc .

I tried to merge the 3 fields you propose to create in only one. It’s straightforward to merge the first two fields but I didnt manage to merge with the third formula. I have the following error : Error with formula: input number 2 to function concat must be directly wrapped by an aggregate function like sum, avg, count etc.
What I understood is that the error comes from the cases where I have two managers in on city. When splitting into different fields, the third formula is applied on each element on the Manager field whereas is one formula, it doesnt work ? Am I correct? Do you see any way to merge those fields into one?

Using this method, I end up with a link in a new tab. Is there a way to end up with a link to table, so that the link just opens the pop-up to the corresponding entry?

Thanks for your answers,

Hello asan,

I tried to simulate the problem and the formula seems to work with multiple manager for one city:

I think that the problem is with the parentheses because I am only merging two fields (a base url and an id) and not 3 fields. The part


is the second argument of the button() function and not the third argument of the concat() function.

If you just want to open a pop-up, you need a field of the type “link to table” like the field Staff

Thanks for your answer!
Sorry but I am not sure about your answer for the merging of the three fields. Have you merged them?
And for the pop-up, that is not currently possible to create a « link to table » using a formula, right? Is that a feature you have discussed? That would actually be great because in our case, that’s not very user-friendly to switch to a new tab to get the information!
Thanks :slight_smile:


I merged only 2 fields: the base url and the id of the item.

You cannot create a “link to table” field with a formula. The link to table indicates the datatype of the column, not the items that should appear in it.

Thanks for your answer :slight_smile:

@olgatrykush This would be a great new feature to allow formulas to end up with a link that opens the same pop-up as a link-to-table field.

For instance, in your example, clicking on a value of the field Link to member would open the corresponding entry in a pop-up and not in an other table.


Is it similar to the request that we discussed in this thread: Display formula results like link rows when relevant - #3 by maxime?

Hi Olga!
Yes, that is the same request! I’ve seen that you plan to add this feature! Do you have any idea on when this could be done?