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 448
  • 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