Row Filter Issue with User's Team ID

Hi everyone,

I’m trying to filter a data table base on the current user’s team_id. I followed a post’s recommandation and created a current user table.

  • User table: id, email,team_id,role
  • Data table: id, name, value, team_id (virtual column)

I’m using the following expression in the row filter condition:

data[team_id]=user[team_id]

However, the expression returns N for all rowsm even when some team_id values shoud match. Could anyone advise where I might be going wrong?

1 Like

you will need to follow his post in more detail.

on what table is the row filter condition being held?

IF is in table data then it can be [team_id] = user[team_id] (you don’t reference the table you are currently working in unless you need the whole list.

data[team_id]=user[team_id]

This compares the whole list of team ids in the data table to the whole list of user team ids. will always equal N.

also you will need a slice that is for the user accessing the app currently from your users table as stated in the post. the slice check email vs useremail.

Then you will have to index(slice name[team_id], 1)

so we will look at the row filter condition to be [team_id] = index(slice name[team_id], 1)

2 Likes

Hi,

Thanks for you answer. I will read the post once again. I had created a new slice but I wasn’t using it, sorry. However, [team_id] = index(slice name[team_id], 1) return me the error “Cannot compare List with Ref”.

Ok, I got it! It is because I use Ref type for team_id attribute. As team change their name sometimes, I listed them in a different table (team: team_id, team_name).

Is there any good way to do in the user table to select the team?

2 Likes

Hi,

Thanks for the support. Just to let you know that it has been solved wiht :

[team_id]=CurrentUser Slice[team_id]

No problems with Ref as type.

1 Like