Switch function for table updates based on users

Hi everyone,

I think this question has been asked before but I couldn't find the proper solution for my problem. For my case, I made 2 separate tables (a table for list of managers and a table for list of employees) and each table consists of list of users which has different roles for my application. I would like these users to have different abilities to update the table based on their roles and at the Are updates allowed?, I inputted this expression:

SWITCH(USEREMAIL(),
User_Employee, "UPDATES_ONLY",
User_Manager, "ALL_CHANGES",
"READ_ONLY")

 

The expression passed, however, when tested, both users in the Employee and Manager table doesn't allow any Updates, Add neither Delete and it just displayed the data as Read Only. Please advice on my expression. Thank you everyone!

0 5 338
5 REPLIES 5

Do you understand how the SWITCH() expression works?

https://help.appsheet.com/en/articles/2355972-switch

Do you understand that USEREMAIL() returns an email address?

https://help.appsheet.com/en/articles/2357268-useremail

What are "User_Employee" and "User_Manager" in your expression supposed to be?

The User_Employee and User_Manager would be the two tables consisting of emails for the employees and managers. What I understand from the SWITCH() expression is that it will gather the user emails in that table and allows the users to make changes based on how we set their abilities to add/update/delete the data in that table.

That's not even close to what SWITCH does.

I'm guessing that you'll need to use IFS() and IN().

https://help.appsheet.com/en/articles/2355961-ifs

https://help.appsheet.com/en/articles/2357277-in

 

Thank you Marc for the suggestion. I tried this expression:

 

IFS(IN(USEREMAIL(), User_Manager[Email]), "ALL_CHANGES", IN(USEREMAIL(), User_Employee[Email]), "UPDATES_ONLY",)

 

The expression passed and as for the Manager side, it allowed me to make all changes. However, as for the Employee side, it only allowed me to read the data but not make any updates.

That expression looks good. You must have just made a small error. Keep trying.

Top Labels in this Space