I have a list of 35 email addresses and roles that look like this:
john.doe@gmail.com, Chairman jane.doe@gmail.com, Vice Char james.johnson@, Clerk โฆetcโฆ
Each role type (Chairman, Vice Chair, Clerk) needs to have edit access to a different table in my app (Bills, Committees, Calendar).
I need to reference this table of email addresses and roles in the โAre updates allowedโ formula in the data table, like this:
SWITCH(USEREMAIL(),
[list of email addresses corresponding to the โChairmanโ role], โUPDATES_ONLYโ, โREAD_ONLYโ)
What is the exact expression I need to enter to grant all the people in the โChairmanโ role edit access to this table?
Thank you very much,
Daniel
Assuming the table containing the list of emails and roles is UserTable, and emails and roles are in the [email] and [role] columns, respectively, and that there is only one row (and thus only one role) per email:
switch(lookup(useremail(), UserTable, email, role), โChairmanโ, โUPDATES_ONLYโ, โREAD_ONLYโ)
The appsheet angels have visited me!
After waiting for about 10 minutes - it began working. Thanks +Steve Coile!
Any idea how I can add MULTIPLE roles to have the same edit access?
For example, I also want โVice Chairmanโ to also be able to edit.
Is that possible?
Thanks again!
Another question: How do I give everyone in the table, regardless of role, edit access?
@Daniel_Street You can do that with switch():
switch(lookup(useremail(), UserTable, email, role), โChairmanโ, โUPDATES_ONLYโ, โVice Chairmanโ, โUPDATES_ONLYโ, โREAD_ONLYโ)
The first argument to switch() is the value you want to test. The first argument is followed by 1 or more pairs of arguments. Each pair consists of a match value (against which the first argument of the switch() is compared), and a corresponding result value (the value returned by switch() if the match value matches). The final argument to switch() is the default result value, the value if no matches occur.
@Daniel_Street You want to give everyone in the list edit access. Are there users of the app that have access to the app but arenโt on the list?
To give only users on the list edit access (โUPDATES_ONLYโ) while limiting all other users to read-only, you should replace the switch() expression with an if() expression:
if(in(useremail(), UserTable[email]), โUPDATES_ONLYโ, โREAD_ONLYโ)
+Steve Coile Sir, you are a gentleman and a scholar. Thank you.
User | Count |
---|---|
43 | |
27 | |
24 | |
23 | |
13 |