The application has two views:
The data has the table that specifies the admin users:
I need to limit Secret Information view to admins only.
1. Do I understand correctly that I need to go to UX > Secret Information > View Options > Display and input a specific fomular into Show if field?
2. What is the formula?
Thanks!
Solved! Go to Solution.
@Evgenii_P wrote:
However, when I click "Cancel" I am taken to a Secret View, which I am not supposed to see.
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.
1. Yes.
2. Review the "Current User (Slice)" and other techniques summarized in SUMMARY TIP: User permissions, roles, and settings - Google Cloud Community .
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:
Do I understand correctly that:
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?
Q4. If AppSheet finds the "Admin," the view will be available to the user, won't it?
Q5. What does 1 stand for in the formula: INDEX(Current_User[Role], 1) = "Admin"?
You've been very patient with me in the past. I hope you can address these questions with the same attitude and spirit ๐ Thank.
Great job! It looks like you have this aspect of your app working as intended. Here's further explanation per your questions.
@Evgenii_P wrote:
Q1. Do I understand correctly that a Slice is a strictly defined data point from a table?
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.
@Evgenii_P wrote:
Q2. In this case, what does this Slice do? In other words, what does formula USEREMAIL() = [Email] help me accomplish?
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.
@Evgenii_P wrote:
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?
Correct!
@Evgenii_P wrote:
Q4. If AppSheet finds the "Admin," the view will be available to the user, won't it?
That's right.
@Evgenii_P wrote:
Q5. What does 1 stand for in the formula: INDEX(Current_User[Role], 1) = "Admin"?
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("Admin")
. Also IN("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.
From a form view, the only options are to either save or cancel, and it looks like you've renamed those options to "Send" and blank.
Ok, that makes sense. However, the same issue happens when I try to do that in a mock-up app.
What am I doing wrong?
@Evgenii_P wrote:
However, when I click "Cancel" I am taken to a Secret View, which I am not supposed to see.
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.
try,
USERROLE() = "Admin"
Hello, Swoopy! Thanks for the answer.
I now have this under Secret Informtion display options:
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?
@Swoopy's solution pertains to using formal AppSheet-defined roles--not custom roles managed via an app table.
Look up the top right of editor
Setting you made on the App Role
AppSheet refers to this in app's settings, no extra works required.
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:
1. Home Screen (Onboarding): this is a starting view.
2. Compose a response (Form View)
3. 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.
User | Count |
---|---|
17 | |
11 | |
11 | |
8 | |
4 |