How to personalize tables with People lookup value instead of People values

I have an issue with personalized assignment tables based on lookup values. Previously this worked great when I assigned users directly in my Tasks table. Here’s an example of the table filter.

thisRow.Done=false AND thisRow.Responsible.Contains(User())

By selecting the user directly in the Responsible column in the Task table, the filter returned tasks assigned to the logged on User()

However, when I changed the Responsible column to a lookup column to look up the Responsible person from a responsible column in a “Responsible and Roles” table, this User() function breaks as it’s not a full user object any more. Just a lookup text value I suppose.

Are there any way to match the name of the User() object and compare it to the name as text from the value? And then filter based on this? Or are there any other ways of dynamically filtering based on the lookup value?

I tried to add a second “Person” column with formulas like:

User(thisRow.Responsible)
thisRow.Responsible.User()

My hope was that it would find the lookup value and convert it to an actual user object, but that did nothing.

Example of test

1 Like

Looking at your screenshot, your Responsible column is not a People-formatted column (as you realized). It is rather lookup to the People and Roles table, which contains one People-formatted column called Name.

I think what you might want to do is, for your additional People-formatted column, make the formula instead thisrow.Responsible.Name since Name is what you called the People column in your People and Roles table (as I see in the screenshot).

Alternatively, you could skip straight to the person reference directly in the Responsible column by making that one a People column type rather than a lookup. Unless you’re using it for something other than filtering.

Yet another alternative is to simply adjust your filter formula to this:
Not(thisRow.Done) AND thisRow.Responsible.Name.Contains(User())

1 Like

By the way, you can compare Users as text by using the built-in Name property (or Email) like so: User().Name or @Ryan Martens.Name both return "Ryan Martens"

But it’s not necessary and almost always to better anyway compare User objects directly, in case two people have the same name.

1 Like

I’m using the people column for more than filtering, so I have to keep it as a looup rather than a direct People column.

This worked very well. Seems the only thing was the “Name” part to make the comparison work:
Not(thisRow.Done) AND thisRow.Responsible.Name.Contains(User())

The comparing of user or mail is also a good idea. Thanks @Ryan_Martens2. Great help as allways :slight_smile:

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.