List of Editors

Hello,

I would like to create the table with list of approved editors for my app, and than on the base on user email to let the user edit or just read only. My idea is to create “Editors” table just with “Mail” column and to use code to check if user email is on Editors table and than add proper access.
The code :
SWITCH(USEREMAIL(),
LOOKUP( “USEREMAIL()” , “Editors” , “Mail” , “Mail” ), “UPDATES_ONLY”,
“READ_ONLY”)
Still not working but do you thing it is a good idea or is it better to do it other way?

0 6 451
  • UX
6 REPLIES 6

Try something like…
IF(
IN(USEREMAIL(),Editors[Mail]),
“UPDATES_ONLY”,
“READ_ONLY”
)

Steve
Platinum 4
Platinum 4

@Aleksi’s suggestion is a good one.

The reason your expression didn’t work is because you enclosed USEREMAIL() within quotes in your LOOKUP() expression:

LOOKUP( “USEREMAIL()” , “Editors” , “Mail” , “Mail” )

As a result, LOOKUP() was looking for the literal text, USEREMAIL(), rather than for the current user’s email. Had you instead used:

LOOKUP( USEREMAIL() , “Editors” , “Mail” , “Mail” )

without the quotes around USEREMAIL(), it likely would have worked fine.

Thanks both @Aleksi and @Steve both suggestions work perfectly, and I even prefer one from @Aleksi better than my first idea!

Hello another step… can I nest IFs in this expression? I tried sth like this, and it does not work:

IF: (IN(USEREMAIL(),Experts[ExpertMail]),
“ALL_CHANGES”,
IF(IN(USEREMAIL(),Editors[EditorMail]),
“ADDS_ONLY”,
“READ_ONLY”)
,“READ_ONLY”)

Try this instead:

IF(
  IN(USEREMAIL(), Experts[ExpertMail]),
  “ALL_CHANGES”,
  IF(
    IN(USEREMAIL(), Editors[EditorMail]),
    “ADDS_ONLY”,
    “READ_ONLY”
  )
)

Or this:

IFS(
  IN(USEREMAIL(), Experts[ExpertMail]),
    “ALL_CHANGES”,
  IN(USEREMAIL(), Editors[EditorMail]),
    “ADDS_ONLY”,
  TRUE,
    “READ_ONLY”
)

See also:




Thanks a lot, worked perfectly as usual!
I have read above but somehow got lost in nesting - my experience in coding is close to zero

Top Labels in this Space