Using ShowIf function to seperate User pages

expressions
(Brandon Williamson) #1

OK Interesting problem.

My app is a score tracking app. Functionally everything is working perfectly.
With this app each user has the ability enter a score independently of the next user. This is also true for their own score entries to be viewed in a table. The idea is that when they are in the app, they do not have to select who they are to submit. just enter and save, done deal.

I do this by creating a user Entry page for every user. Then using the “Showif” function with the formula CONTAINS(USEREMAIL().abc@gmail.com) the only user that can see that particular Entry page is whom ever with the "abc@gmail.com" email address. This works wonderfully if I’m never changing users.

I have setup an admin portion to the app which allows me to assign Users Name to a unique entry page. What I need now, is a formula for the Showif function to look up the name assigned or rather the email assigned in my table for that User to view and use the Entry page.

Believe I’ll need to run a LOOKUP command to find the specific table. Then tell it if it CONTAINS the USEREMAIL in that particular Row of the table.
In a Spreadsheet I can figure this out, with the appsheet Expressions on the other hand… Playing a lot of guess work.

Anybody able to help with this?

(Steve Coile) #2
USEREMAIL() = LOOKUP(
 "Entry Page Name",
 "Entry Page Table",
 "Page Name",
 "User Email"
)

where:

  • Entry Page Name is the name of the page you’re checking access for.

  • Entry Page Table is the name of the table containing your access information.

  • Page Name is the name of the column in that table that contains the page name. LOOKUP() will attempt to find Entry Page Name in this column.

  • User Email is the name of the column, also in the same table, that contains the email of the user allowed to access the page named in the Page Name column of the same row. If LOOKUP() finds Entry Page Name in the Page Name column, it will return the value of the User Email column of the same row.

So LOOKUP() finds the email address attached to a given page, then you just have to compare that result with the app’s current user (USEREMAIL()) to determine if the current user is the one allowed to see the page.

(Brandon Williamson) #3

Ok, Let see here

“Entry Page Name” If I understand you correctly, this will be the sheet that is used for the entries. which would be “Angler 1” in this case.
“Entry Page Table” This should be a Sheet named “Anglers”

here is a screen shot of the table i’m using. This sheet is the “Anglers” Sheet (blocked out the names and emails on purpose)

So if i’m following correctly, my Formula should look like this?
USEREMAIL() = LOOKUP(“Angler 1”, “Anglers”, “Angler Number”, “Emails”)

1 Like
(Brandon Williamson) #4

Just confirmed it works!

Thanks a bunch

1 Like