I have a list of 35 email addresses and roles...

expressions
(Daniel Street) #1

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

(Steven Coile) #2

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”)

(Daniel Street) #3

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!

(Daniel Street) #4

Another question: How do I give everyone in the table, regardless of role, edit access?

(Steven Coile) #5

@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.

(Steven Coile) #6

@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”)

(Daniel Street) #7

+Steve Coile Sir, you are a gentleman and a scholar. Thank you.