restrict acces to a view using show-if option

Hello!

I'm trying to restrict the access to a form view, using Useremail() and a referenced column from another table; it doesn't work, the error message is : Cannot compare Email with List in (USEREMAIL() = Table[Column_email]). I used that condition in "row filter condition" on slice, some other time, and it worked well. now, I don't understand why not. I need to search the email in another table, where I have the users' email.  I tried other ways, to use IN, Select, LIST, etc, but I can not succeed to write the condition, or the condition is ok, but the access is not limited, or the condition has errors.

Thank you for your help!

Regards!

Ruxandra

0 11 225
11 REPLIES 11

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Ruxandra 

 I think you almost got it 🙂

You may want to use this expression:

IN(USEREMAIL(),Table[Column_email])

 For reference:

IN() - AppSheet Help

Aurelien_0-1689080932597.png

 

Hello!

I also try this condition, there is no error in the expression, but access
is not restricted either. The user whi is not in the column could see this
view.

Thank you!

Regards!

Ruxandra

Hi @Ruxandra 


@Ruxandra wrote:

I'm trying to restrict the access to a form view,


This makes me thinkof where you write the above expression.

Spontaneously, I would suggest:

1) using the Behavior section of the Edit action:

Aurelien_0-1689101202643.png

 

2) using the table permission:

Aurelien_1-1689101256669.png

Aurelien_2-1689101342058.png

(you can set any condition here)

Hello!

I wrote it in "show-if" field of the view. Is it not right? It works if I write IN (useremail(), {list of value}, but it seems it not works if I use  a specific column from table.

If you wish to focus on a specific column rather then the whole record, then I would rather use Editable_If instead instead of Show_if:)

Aurelien_0-1689142788930.png

 

Hello again!

I have tried to write the condition in the table permission, as you said, I receive this error: "The expression is valid but its result type 'Yes/No' is not one of the expected types: Enum". The expression is : IN(Useremail(), table[column].

Thank you for your help!

Regards!

Ruxandra


@Ruxandra wrote:

I have tried to write the condition in the table permission, as you said, I receive this error: "The expression is valid but its result type 'Yes/No' is not one of the expected types: Enum". The expression is : IN(Useremail(), table[column].


This is because here, you have to define a set of permissions over the whole table. 

With no information about your need, I suggested various ways to proceed 🙂

You could use this for example if you wish to use only two types of permission over the table:

IF(IN(USEREMAIL(),table[emailcolumn]),
  "ALL_CHANGES", 
  "READ_ONLY"
)

 For reference:

Control add, update, and delete operations - AppSheet Help

(I strongly invite you to read every piece of documentation provided)

I think I wasn't clear enough; I want that view not to be visible for everyone having access to the app, I want to be visible only for the users who are in that table column. I succeeded do this for another view, having a limited number of user, with IN condition, and write the short list of users. 

I tried your expression in table Settings; the view is still visible; I have also read the documentation. Something doesn't work well.

Thank you!

Regards!

 


@Ruxandra wrote:

I think I wasn't clear enough; I want that view not to be visible for everyone having access to the app, I want to be visible only for the users who are in that table column.


 

Ok, then I would suggest using it in a security filter 🙂

For reference:Security filters: The Essentials - AppSheet Help

Aurelien_0-1689159103673.png

 

Alternatively (and I think that is what you already did), you can use it in a slice and create a slice based on it.

 

Hello!

I used Security filter, but the filter is applied on the table; I only want that the form not be visible; some users need to fill the form, without having acces to the table, some other users need to see the data in the table without being able to see the form. Thank you!

Regards!

Ruxandra

Hi @Ruxandra 


@Ruxandra wrote:

some users need to fill the form, without having acces to the table


This is not possible. A form is by nature attached to a table.


@Ruxandra wrote:

some other users need to see the data in the table without being able to see the form


Did you try this?


@Aurelien wrote:

1) using the Behavior section of the Edit action:

Aurelien_0-1689101202643.png


 

EDIT : the "Edit" action is the one that opens the form view

Top Labels in this Space