Is it possible to create relational data between User( ) and other column?

Hello . I would like to know if it is possible to create this relational data?

for example, I have table A and table B
In Table A , there would be 4 columns as following,

  1. task name
  2. user
  3. button that click to take a task and modify user column =user( )
  4. relational database from table B, for example department.

and Table B , maybe, have two columns

  1. user
    2.Department

Then, I want to click button and then pull information of table B department to Column A department

Can anybody help with code?

TableB.filter(currentValue.user = User() ).First().Department

The First() is there in case your other table has multiple rows for the same user, ensuring you always get one result.

Just to be clear, the above pulls department of the currently logged in user. If you instead want a column formula for the department of whatever user is chosen in a row, it’s

TableB.filter(currentValue.user = thisRow.user).First().Department

thisRow means the row of the table this formula is in

CurrentValue means a row in the other table that is currently being evaluated by the filter (the filter will loop over all rows of the other table looking for a match)