Field data filter according to username

Gutsy
New Member

Hi there,

First I would like to express my appreciation for AppSheet Team, Appsheet is a fantastic solid data base platform were it can transform ideas to well structured application with ease.

I have a primary view which include fields connected to more than one tablesโ€™ columns. what I would like to do is to have one of the fields data to be filtered based on the user signing in. So please can I have a detailed instructions how this can be done?

As to clarify my question I will give the following example:
letโ€™s assume I have a list text field named ABC in a primary view. that field is a reference from a related table named X.Table X has the following columns as attached
2X_d_d05c3a5b5d67a8dcbfc64358e92015c693ed1393.png

Now what I want to do is, when user1@gmail.com will log in, the field ABC has to show 2 category rows (1) Hobbies and (2) Shopping and when user2@outlook will log in the field ABC has to show 3 category rows (1) Home Expenditures, (2) Vacation and Travel and(3) bills and Utilities.

I am open for any scenarios, any suggestions?

Thanks in advance.

Solved Solved
0 7 2,977
1 ACCEPTED SOLUTION

First, on Ref columns you can access the other column values int he table using โ€œdotโ€ notation: For example: [Ref Column].[Other Ref Table Column]

Next, AppSheet has a built in feature known as Security Filters. Basically, at the table level, you would add in the Security Filter property an expression like (based on your example):
USEREMAIL() = [ABC].[User].

Only those rows where the [User] column of the ABC Ref value that match the logged in user Email will be made available on that users device.

I hope that is clear!!


If you also want to allow for Admin type access, you can include that in the expression as well. Iโ€™ve included the article for that also.

View solution in original post

7 REPLIES 7

First, on Ref columns you can access the other column values int he table using โ€œdotโ€ notation: For example: [Ref Column].[Other Ref Table Column]

Next, AppSheet has a built in feature known as Security Filters. Basically, at the table level, you would add in the Security Filter property an expression like (based on your example):
USEREMAIL() = [ABC].[User].

Only those rows where the [User] column of the ABC Ref value that match the logged in user Email will be made available on that users device.

I hope that is clear!!


If you also want to allow for Admin type access, you can include that in the expression as well. Iโ€™ve included the article for that also.

John

I tried your scenario, it accepted the formula and the table hide the rows where user email address not in relation thank you.

Now the table EFG has a form view where in that view the list field ABC that is related to Table X. Also I would like the user only to choose and see list records that is related to his login.

Again to clarify

ABC is a list field in Table EFG form view.
ABC is column in Table EFG that is referenced(get its data) from TableX column Category.

I want the user to be able to select only category records that is related to the user login.

Thank you again.

Actually, I think there is a better, simpler way that I didnโ€™t see before.

Simply apply the Security Filter to your Table X - the expression being: USEREMAIL() = [User]. Then you donโ€™t need to do anything in ABC or EFG as far as Category selection is concerned.

Yes your are right. I did it and it worked like a charm.

Thank you so much for your help, really appreciated.

Gutsy
New Member

John

Well received and noted.

Thank you so much for your update, I will do accordingly and get to you with an update. on the other side and as I did some research. the guides said that username function in security filters is not that reliable specially for google accounts.

any comments of such issue?

Again thank you so much for your help.

USERNAME() is a bad choice for a variety of reasons. USEREMAIL() is a good choice.

See also:


Thank you Steve

Noted, will get with a feedback soon.

Top Labels in this Space