My questions is: How would AppSheet know that a particular user is an admin? I know I have specified the admins in the sheet, but there is no reference to that row in the formula, isn’t there?
Hello, dbaum. And thank you once more for attending to my question.
I’ve read the article you referred me to and blindly followed the steps. I say blindly because I don’t really understand the meaning behind the formulas and what they do.
First thing I did was creating a slice for my Users table:
Q1. Do I understand correctly that a Slice is a strictly defined data point from a table? Q2. In this case, what does this Slice do? In other words, what does formula USEREMAIL() = [Email] help me accomplish?
The second thing I did was putting a condition in the Show If of the Secret Informstion view:
Q3. This formula gets AppSheet to look (or INDEX) at the slice Current_User, then look at the the column [Role] in the Users table (picture below) and see if that users has an “Admin” there. Correct?
Great job! It looks like you have this aspect of your app working as intended. Here’s further explanation per your questions.
A slice is a subset of a table. A table comprises columns and rows and has associated actions. A slice is a designated subset of a table’s columns, rows, and/or actions.
A slice’s Row filter condition contains an expression that is evaluated for each of the table’s rows to determine whether the row is included in the slice. In this case, if a row’s [Email] column value equals the value returned by the function USEREMAIL, then the row is included in the slice.
Correct!
That’s right.
The INDEX function returns a value from a designated position within a list. “1” references the first item in the list. Current_User[Role] returns a list of all the values in the Role column of the Current_User slice; even if that list comprises only a single value, its data type remains list and, therefore, to reference the value you need to use a function like INDEX that extracts a single value from a list in order to then compare that value to “Admin”. To understand the concept it can be helpful to consider alternate formulas using other functions. For example, although Current_User[Role] could never be equal to "Admin" it could be equal to [LIST](https://support.google.com/appsheet/table/10104782?hl=en#query=list()("Admin"). Also [IN](https://support.google.com/appsheet/table/10104782?hl=en#query=in(t)("Admin", Current_User[Role]) would tell you whether “Admin” is a value within the list.
Thanks for the great explanation! I think I’m nearing the solution.
One issue I encounter: When an admin is looking at the form, they are not given the option to move to another view for which they’ve been authorized? Like, there is no button at the bottom to navigate out of the form. Any idea how to fix this? The current view is open to everyone; however, I want Admins to be able to click out of this view to look at the detailed view of the form.
In other words, I want Admins to be able to switch between the Form (that is open to every use) and form answers (that are open only to Admin). I would like to achieve something similar to this view, where Not Secret Information is the form, and Secret Information is the answer to the form.
What view was displayed before navigating to the form view? I believe that selecting Cancel in a form view returns the user to the prior view.
Regardless, don’t lose sight of Steve’s point: A view’s Show if property only governs whether the view is included among explicitly displayed navigation options–not whether it’s available via other means. For non-admin users, be sure to use applicable techniques to filter out or not show the data in your secret view.
Hello @dbaum and @Steve , you’ve helped me immensely in the past, and I’m hopeful that you can do so again
This time, my question is fairly simple.
Application has Three views:
Home Screen (Onboarding): this is a starting view.
Compose a response (Form View)
My response (Table View)
I would like My response (Table View) to be only accessible to users who have submitted a response through Compose a response (Table View). Logically, I would like Compose a response to stop being accessible to users who have submitted a response/filled out the form.
In other words, what I am trying to accomplish is that a user fills out one form, and then can only revisit their answers for revision and improvement.
I’ve used Show if formula before to accomplish similar things, and I hope Show if can be used to achieve the desired result in this situation as well. Thanks.