Getting A Error - This formula is not evaluated in the context of a row, so column values are not av

I am trying to express a permission setting with the following:

SWITCH(any(RAD TEAM[Role]),
"Director, Clinical Informatics", "ALL_CHANGES",
"Director, Account Management", "ALL_CHANGES",
"Director, Account Management", "ALL_CHANGES",
"Director, Service Delivery", "ALL_CHANGES",
"Senior Director, Account Management", "ALL_CHANGES",
"READ_ONLY")

 

But get this error - This formula is not evaluated in the context of a row, so column values are not available.

0 4 781
4 REPLIES 4

Since permissions are for users, those need to be evaluated in the context of the logged in user to see what kind of permissions the user has based on her/his role. 

A logged in user is in turn identified by the user's email used for logging into app.

So you will need to modify the above expression something like 

SWITCH(ANY(SELECT( RAD TEAM[Role], [Email]=USEREMAIL())),
"Director, Clinical Informatics", "ALL_CHANGES",
"Director, Account Management", "ALL_CHANGES",
"Director, Account Management", "ALL_CHANGES",
"Director, Service Delivery", "ALL_CHANGES",
"Senior Director, Account Management", "ALL_CHANGES",
"READ_ONLY")

It is assumed that the "RAD TEAM" table has a column [Email] to store the email of each user , [Role] column to store the role of the user and there is one row per user to define her/his role and email.

Suggested changes highlighted in bold.

I don't know what the issue is.

In the community, I've seen comments about periodic unreliability of the ANY function. Try instead using INDEX:

INDEX(RAD TEAM[Role], 1)

ICYMI: The following is redundant.


@mendozacardinal wrote:

"Director, Account Management", "ALL_CHANGES",
"Director, Account Management", "ALL_CHANGES",


 

Here is another approach for the expression

Solved: Add more emails to "Are updates allowed?" - Google Cloud Community

 

Also please consider using the Current_System suggested by @MultiTech 

Instead of expressions such as ANY(SELECT( RAD TEAM[Role], [Email]=USEREMAIL())),you could use an expression like ANY(Current_User[Role]) when you have  a slice created for the Current_User per very useful tip below.

Current User (Slice) | How to conform your app a... - Google Cloud Community

 

 

@mendozacardinal,  you should absolutely be using this technique. When I replied previously, I assumed that was already the case--i.e., that RAD TEAM was a slice filtered to the single relevant row. If that's not already your app's design then definitely follow @Suvrutt_Gurjar's advice; additional guidance appears in  SUMMARY TIP: User permissions, roles, and settings - Google Cloud Community

Top Labels in this Space