Hide views according rol

Hi there,

I need help please.

1. I'm using an expression with usersetting in my app: USERSETTINGS("User Name")

2. I have a table with some columns.  Two of these columns are:  UserName and Rol (Admin, Manager, user)

3. I have a Menu with these views:

HguillenA_0-1675294855975.png

4. For example. Inside Cash,  I have others views:  Some of these have view type > Form, galery, chart and also, some comes from Slices.  The app has 30 views in total

HguillenA_1-1675294938122.png

5. I need show some views depending rol (Admin, Manager, user). For example, I want show Cash view (Type view = Galary) only to username with Admin or Manager rol.  So I used this expresion in show if: In(ANY(SELECT(Team[Rol],[UserName]=USERSETTINGS("User Name"))), {"Admin","Manager"}). My problem is: the expression is not functional.

Thank you for your suggestions

 

 

 

 

 

 

 

 

0 2 207
2 REPLIES 2


@HguillenA wrote:

In(ANY(SELECT(Team[Rol],[UserName]=USERSETTINGS("User Name"))), {"Admin","Manager"})


I don't see anything wrong with your expression's syntax. I suggest testing it piece by piece--e.g., confirm the result of the USERSETTINGS function and what list of values results from the SELECT function. You could also try Constructing a list using the LIST() function - AppSheet Help instead of directly Constructing a list of values - AppSheet Help in case something is off in that portion of your expression.

BTW, an alternate form of your expression might be:

ISNOTBLANK(INTERSECT(SELECT(Team[Rol], [UserName] = USERSETTINGS("User Name")), {"Admin", "Manager"}))

 

Hi @HguillenA,

I came across a similar situation. I found out that I had created a custom submenu, defined the view as 'ref' and created actions from main Menu to reach to the submenu. 

The Show If option under display session in the SubMenu View is not useful in this case. 

I had also tested switching the view of the Submenu to 'Menu' or later "later'. Then is it showing/hiding according to the user role. even in that case, user can reach the view through the Main Menu->SubMenu->"This particular view".

Let me know if you have any solution. 
-sabari


Top Labels in this Space