Need help with expression

There are employees in our database and they all have different “roles” which are predefined by the admin - me.

I have created an expression from a slice from the main employee sheet that filters out all but the current user, to ‘log’ the role of an employee when he/she logs in. Its any(Profile slice[Role]).

Now there’s an action within the employee profile, named Employee Expenses which takes a seeker to the expense table of the concerned employee.

I want that action to be available to Admins, moderators and managers, and managers should not be able to view the action when the concerned person is an Admin or moderator.

I have written the following expression:

or(
and(any(Profile slice[Role])=“Manager”, and([_THISROW].[Role]<>“Admin”, [_THISROW].[Role]<>“Moderator”)),
any(Profile slice[Role])=“Moderator”,
any(Profile slice[Role])=“Admin”
)

But the action is showing up for every employee, when the reviewer is a ‘Manager’, regardless of his/her position in the company hierarchy. I cannot figure out what’s wrong.

It seems to be a problem with the [_THISROW].[Role] expression.

Got it. Didn’t need the [_THISROW]. before [Role]. Just using [Role] sufficed.

But this is the ‘to make it work, do how it works’ scenario, I can not figure out why [_THISROW] doesn’t work here. I hope someone would explain.

I suspect it doesn’t work as you intend, if you do more testing.

Unless the Employee Expenses table itself has a Role column?

It did have. Yes.

1 Like