Problem with privileges expression

Hello,

Im developing an app using appsheet and i want to control privileges over different tables, but i have a problem with the formula of the โ€œAre updates allowed?โ€ field.

This is the formula im using

SWITCH(LOOKUP(USEREMAIL(),โ€œusuariosโ€,โ€œemailโ€,โ€œrolโ€),
โ€œRTโ€, โ€œUPDATES_ONLYโ€,
โ€œadministradorโ€, โ€œALL_CHANGESโ€,
โ€œREAD_ONLYโ€
)

But im receiving an error:

SWITCH function is used incorrectly: Cannot convert input 2 of type โ€˜Textโ€™ to โ€˜List of Textโ€™

Cant understand why since data types and args seems to be correctโ€ฆ

Thank you very much!

Solved Solved
0 2 165
1 ACCEPTED SOLUTION

Hello @Hernan_da_Silva, welcome to our community !

Is your โ€œrolโ€ column in your โ€œusuariosโ€ table an Enum of base type text?

Also do check this post out, it makes handling user permissions waaaaaaaaaaaaaaay easier:

I believe youโ€™re just one slice away from having it completely set up.

View solution in original post

2 REPLIES 2

Hello @Hernan_da_Silva, welcome to our community !

Is your โ€œrolโ€ column in your โ€œusuariosโ€ table an Enum of base type text?

Also do check this post out, it makes handling user permissions waaaaaaaaaaaaaaay easier:

I believe youโ€™re just one slice away from having it completely set up.

Rafael, thank you very much for your quick and correct response!

Yes, you were right, insted of Enum, EnumList was being used, such a stupid error.

Thanks for your suggestion about slices. Currently im using security filter, because i definitevely donโ€™t want any data to be access by users who shouldnt have that possibility, that is managed through another column in that same users table.

Again, thanks!

Top Labels in this Space